From 02adea39628f11fe827df682e9e2db66588ae35d Mon Sep 17 00:00:00 2001 From: hulkoba Date: Mon, 18 Dec 2023 12:48:02 +0100 Subject: [PATCH] fix(fuzz): pass buffered to readBinary funcs --- test/fuzz/readKeyBinary.js | 4 ++-- test/fuzz/readMessageBinary.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fuzz/readKeyBinary.js b/test/fuzz/readKeyBinary.js index 3715bb5a..20a59dc3 100644 --- a/test/fuzz/readKeyBinary.js +++ b/test/fuzz/readKeyBinary.js @@ -10,8 +10,8 @@ function ignoredError(error) { * @param { Buffer } inputData */ export function fuzz (inputData) { - const binaryKey = new Uint8Array(`-----BEGIN PGP PRIVATE KEY BLOCK-----\n ${inputData.toString('base64')} -----END PGP PRIVATE KEY BLOCK-----`); - + const binaryKey = new Uint8Array(inputData); + binaryKey[0] |= 0x80; return readKey({ binaryKey }) .catch(error => { if (error.message && !ignoredError(error)) { diff --git a/test/fuzz/readMessageBinary.js b/test/fuzz/readMessageBinary.js index ae277bfa..2403fdde 100644 --- a/test/fuzz/readMessageBinary.js +++ b/test/fuzz/readMessageBinary.js @@ -10,8 +10,8 @@ function ignoredError(error) { * @param { Buffer } inputData */ export function fuzz (inputData) { - const binaryMessage = new Uint8Array(`-----BEGIN PGP MESSAGE-----\n ${inputData.toString('base64')} -----END PGP MESSAGE-----`); - + const binaryMessage = new Uint8Array(inputData); + binaryMessage[0] |= 0x80; return readMessage({ binaryMessage }) .catch(error => { if (error.message && !ignoredError(error)) {