We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0757482 commit b5e9567Copy full SHA for b5e9567
src/BigNumber.ts
@@ -240,7 +240,8 @@ export class BN {
240
return this.toArray(endian, len);
241
}
242
243
- const outLen = len != null ? len : this.byteLength();
+ // Ensure minimum array length of 1 to prevent native crashes with zero-length buffers
244
+ const outLen = len != null ? len : Math.max(1, this.byteLength());
245
246
const res = new (arrayLike as any)(outLen);
247
0 commit comments