From 64f4bb7a7c0384fecfb3c3a25105354cd2984986 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Fri, 2 Aug 2024 10:40:36 +0200 Subject: [PATCH] Fix - correctly handle empty std::map Seems to be, no extra information written into the buffer when map is empty --- modules/io.mjs | 5 +++++ 1 file changed, 5 insertions(+) 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