Giter Club home page Giter Club logo

Comments (4)

stephenwvickers avatar stephenwvickers commented on July 28, 2024

Original requester: @rjrivero

from node-asn1-ber.

stephenwvickers avatar stephenwvickers commented on July 28, 2024

This will require more investigation. If it is deemed to be an issue I will address in 1.0.0 by the end of the week, otherwise I may need to consult with the original requester.

from node-asn1-ber.

stephenwvickers avatar stephenwvickers commented on July 28, 2024

Original problem description:

I think there is a problem in the readOID function when a value in the OID is higher than 2^31. It is returning negative numbers. For example:

var ber = require("asn1").Ber;

// Buffer contains OID 1.3.6.1.4.1.14988.1.1.5.1.1.19.2887117176
var data = new Buffer([6,18,43,6,1,4,1,245,12,1,1,5,1,1,19,138,224,215,210,120]);
var reader = new ber.Reader (data)
console.log(reader.readOID());
// prints "1.3.6.1.4.1.14988.1.1.5.1.1.19.-1407850120"
A possible fix would be casting each value to unsigned integer before storing. I.e replacing values.push(value) with values.push(value >>> 0)

from node-asn1-ber.

stephenwvickers avatar stephenwvickers commented on July 28, 2024

User @varadi commented:

I agree with @rjrivero. I ran into the same problem with 32bit OIDs and values.push(value >>> 0) should solve it? Please also

add a release note that this implantation limits OIDs to 32bit (readOID and writeOID)
log an error if an OID exceeds 32 bit, i.e. if the sequence has more than 5 bytes, or has 5 bytes but the first byte has bits 1, 2 or 3 set (bit 0 is 1).

from node-asn1-ber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.