From feab1f34541b194b33fc137498a69318e979d63d Mon Sep 17 00:00:00 2001 From: "Ruben J. Garcia-Hernandez" Date: Thu, 23 Sep 2021 08:16:02 +0200 Subject: [PATCH] Fix 32-bit limitation showcased at https://github.com/Stuk/jszip/issues/777 which causes Bug : uncompressed data size mismatch --- dist/jszip.js | 4 ++-- lib/reader/DataReader.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/jszip.js b/dist/jszip.js index 9f0ffc1d..aaca594e 100644 --- a/dist/jszip.js +++ b/dist/jszip.js @@ -1855,7 +1855,7 @@ DataReader.prototype = { i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); + result = (result * 256) + this.byteAt(i); } this.index += size; return result; @@ -11367,4 +11367,4 @@ module.exports = typeof setImmediate === 'function' ? setImmediate : }; },{}]},{},[10])(10) -}); \ No newline at end of file +}); diff --git a/lib/reader/DataReader.js b/lib/reader/DataReader.js index c4e1e03b..5dae5e57 100644 --- a/lib/reader/DataReader.js +++ b/lib/reader/DataReader.js @@ -61,7 +61,7 @@ DataReader.prototype = { i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); + result = (result * 256) + this.byteAt(i); } this.index += size; return result;