From e862798b9397c0fd9624025f010ca4165de2c0be Mon Sep 17 00:00:00 2001 From: Marc Bernard Date: Tue, 7 Apr 2026 19:11:40 +0200 Subject: [PATCH] fixL `base64_decode` may consume invalid fourth symbol without rejecting --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 4a19b3d..c00dd01 100644 --- a/index.js +++ b/index.js @@ -490,6 +490,7 @@ function base64_decode(s, len) { if (++olen >= len || off >= slen) break; code = s.charCodeAt(off++); c4 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1; + if (c4 == -1) break; o = ((c3 & 0x03) << 6) >>> 0; o |= c4; rs.push(String.fromCharCode(o));