Skip to content

OID values should be unsigned int #24

@rjrivero

Description

@rjrivero

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions