Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number overflow (32 bits limit?) #97

Open
b-zee opened this issue Nov 16, 2017 · 1 comment
Open

Number overflow (32 bits limit?) #97

b-zee opened this issue Nov 16, 2017 · 1 comment

Comments

@b-zee
Copy link

b-zee commented Nov 16, 2017

The following snippet yields 63744:

var asn = require('asn1.js');
 
var Human = asn.define('Human', function() {
  this.seq().obj(
    this.key('firstName').int(),
  );
});

var output = Human.encode({
  firstName: 2500000000,
}, 'der');

var human = Human.decode(output, 'der');
console.log(human.firstName.toNumber());

It seems like an integer overflow. Shouldn't it allow more than 32 bits?

@killerstorm
Copy link

Yes, currently cannot handle numbers >=2^31. Proposed fix here: #90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants