From 6784cd02b4ff4329d07ef949f7d1174181cef056 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sun, 15 Mar 2026 20:03:47 +0000 Subject: [PATCH] Encode section lengths with unsigned LEB128 --- asm.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asm.js b/asm.js index 6154f00..2266591 100644 --- a/asm.js +++ b/asm.js @@ -1327,7 +1327,9 @@ export class Assembler { ]; const sections = template.map(([ code, generator ]) => { const body = generator(); - return body == null ? [] : [ code, body.length, body ]; + if (body == null) + return []; + return [ code, this.uleb128(body.length), body ]; }); return new Uint8Array([ HEADER, sections ].flat(Infinity));