fix(fuzz): pass buffered to readBinary funcs

This commit is contained in:
hulkoba 2023-12-18 12:48:02 +01:00
parent 08cda81233
commit 02adea3962
No known key found for this signature in database
GPG Key ID: ACB6C4A3A4F2BE2F
2 changed files with 4 additions and 4 deletions

View File

@ -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)) {

View File

@ -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)) {