🐛 Fix compressed size calculation, do not change original decryption keys

This commit is contained in:
C-3PO 2018-07-05 02:50:47 +02:00
parent 5ca48459c1
commit 3e9f4843f8
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -31,13 +31,14 @@ export default function extractFileStream(file: ISsnFileEntry, inputStream: stre
let curStream = inputStream; let curStream = inputStream;
//set max length const storedSize = (file.decryptionKeys !== undefined) ? (12 + file.compressedSize) : file.compressedSize;
const maxLength = streamSetMaxLength(curStream, 12 + file.compressedSize); //set max length (including random 12 byte encryption header)
const maxLength = streamSetMaxLength(curStream, storedSize);
curStream = maxLength; curStream = maxLength;
//pipe into decryption if file is encrypted //pipe into decryption if file is encrypted
if (file.decryptionKeys !== undefined) { if (file.decryptionKeys !== undefined) {
const decryptTransform = decryptStream(curStream, file.decryptionKeys); const decryptTransform = decryptStream(curStream, [...file.decryptionKeys] as [number, number, number]);
curStream = decryptTransform; curStream = decryptTransform;
} }