Skip to content

Commit c467340

Browse files
committed
Fix atob in case where we give it invalid unicode with '=' in the middle. Now it still won't error but will at least not give chars out of the 0..255 range
1 parent f0111ff commit c467340

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

core/utils.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,13 +1154,12 @@ while (d!==undefined) {console.log(btoa(d));d=f.read(${CHUNKSIZE});}
11541154
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
11551155
chr3 = ((enc3 & 3) << 6) | enc4;
11561156

1157-
output = output + String.fromCharCode(chr1);
1158-
1157+
output = output + String.fromCharCode(chr1&255);
11591158
if (enc3 !== 64) {
1160-
output = output + String.fromCharCode(chr2);
1159+
output = output + String.fromCharCode(chr2&255);
11611160
}
11621161
if (enc4 !== 64) {
1163-
output = output + String.fromCharCode(chr3);
1162+
output = output + String.fromCharCode(chr3&255);
11641163
}
11651164
}
11661165
return output;

0 commit comments

Comments
 (0)