From d421d4bd3ced889a4143c5c3ab6d95e3be249eee Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 28 Mar 2024 09:26:41 -0700 Subject: [PATCH] fix: do not deref the integrity buffer (#1699) --- src/resedit.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/resedit.ts b/src/resedit.ts index aa9c503..b517da2 100644 --- a/src/resedit.ts +++ b/src/resedit.ts @@ -116,10 +116,15 @@ export async function resedit(exePath: string, options: ExeMetadata) { // Asar Integrity if (options.asarIntegrity) { + const integrityList = Object.keys(options.asarIntegrity).map((file) => ({ + file, + alg: options.asarIntegrity![file].algorithm, + value: options.asarIntegrity![file].hash, + })); res.entries.push({ - type: 'Integrity', - id: 'ElectronAsar', - bin: Buffer.from(JSON.stringify(options.asarIntegrity)).buffer, + type: 'INTEGRITY', + id: 'ELECTRONASAR', + bin: Buffer.from(JSON.stringify(integrityList), 'utf-8'), lang: languageInfo[0].lang, codepage: languageInfo[0].codepage, });