bn.js 4.11.5 → 4.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bn.js CHANGED
@@ -2101,6 +2101,10 @@
2101
2101
 
2102
2102
  assert(this.negative === 0, 'imaskn works only with positive numbers');
2103
2103
 
2104
+ if (this.length <= s) {
2105
+ return this;
2106
+ }
2107
+
2104
2108
  if (r !== 0) {
2105
2109
  s++;
2106
2110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bn.js",
3
- "version": "4.11.5",
3
+ "version": "4.11.6",
4
4
  "description": "Big number implementation in pure javascript",
5
5
  "main": "lib/bn.js",
6
6
  "scripts": {
@@ -62,6 +62,11 @@ describe('BN.js/Binary', function () {
62
62
  assert.equal(new BN('123456789', 16).imaskn(16).toString(16), '6789');
63
63
  assert.equal(new BN('123456789', 16).imaskn(28).toString(16), '3456789');
64
64
  });
65
+
66
+ it('should not mask when number is bigger than length', function () {
67
+ assert.equal(new BN(0xe3).imaskn(56).toString(16), 'e3');
68
+ assert.equal(new BN(0xe3).imaskn(26).toString(16), 'e3');
69
+ });
65
70
  });
66
71
 
67
72
  describe('.testn()', function () {