diff --git a/modules/io.mjs b/modules/io.mjs index 227b22188..f038c889f 100644 --- a/modules/io.mjs +++ b/modules/io.mjs @@ -3549,6 +3549,11 @@ function readMapElement(buf) { } const n = buf.ntoi4(), res = new Array(n); + + // no extra data written for empty map + if (n === 0) + return res; + if (this.member_wise && (buf.remain() >= 6)) { if (buf.ntoi2() === kStreamedMemberWise) buf.shift(4); // skip checksum