From eb32b227e659eba62c308bf28ff59803d2c434d8 Mon Sep 17 00:00:00 2001 From: Lutz Roeder Date: Wed, 27 Nov 2019 03:14:11 -0500 Subject: [PATCH] feat: NSIS uninstaller uncompressed support (#4305) (#4415) --- .../app-builder-lib/src/targets/nsis/nsisUtil.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/app-builder-lib/src/targets/nsis/nsisUtil.ts b/packages/app-builder-lib/src/targets/nsis/nsisUtil.ts index c41de0246c4..cfde8771c8e 100644 --- a/packages/app-builder-lib/src/targets/nsis/nsisUtil.ts +++ b/packages/app-builder-lib/src/targets/nsis/nsisUtil.ts @@ -224,15 +224,15 @@ export class UninstallerReader { let innerBuffer = null while (true) { let size = nsisReader.uint32() - if ((size & 0x80000000) === 0) { + const compressed = (size & 0x80000000) !== 0 + size = size & 0x7FFFFFFF + if (size === 0 || (nsisReader.position + size) > nsisReader.length || nsisReader.position >= nsisReader.length) { break } - size &= 0x7FFFFFFF - if (size === 0 || nsisReader.position >= nsisReader.length) { - break + let buffer = nsisReader.bytes(size) + if (compressed) { + buffer = zlib.inflateRawSync(buffer) } - const compressedData = nsisReader.bytes(size) - const buffer = zlib.inflateRawSync(compressedData) const innerReader = new BinaryReader(buffer) innerReader.uint32() // ? if (innerReader.match(nsisSignature)) {