@btc-vision/btc-runtime 1.0.27 → 1.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btc-vision/btc-runtime",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "Bitcoin Smart Contract Runtime",
5
5
  "main": "btc/index.ts",
6
6
  "types": "btc/index.ts",
@@ -313,7 +313,8 @@ export class BytesWriter {
313
313
  throw new Revert(`Address is too long ${value.length} > ${ADDRESS_BYTE_LENGTH} bytes`);
314
314
  }
315
315
 
316
- const bytes: Uint8Array = new Uint8Array(value.length + 1);
316
+ const length: i32 = Math.min(value.length + 1, ADDRESS_BYTE_LENGTH);
317
+ const bytes: Uint8Array = new Uint8Array(length);
317
318
  for (let i: i32 = 0; i < value.length; i++) {
318
319
  bytes[i] = value.charCodeAt(i);
319
320
  }