Skip to content

Commit

Permalink
fix(fuzz): pass buffered to readBinary funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkoba committed Dec 18, 2023
1 parent 08cda81 commit 02adea3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/fuzz/readKeyBinary.js
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions test/fuzz/readMessageBinary.js
Expand Up @@ -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)) {
Expand Down

0 comments on commit 02adea3

Please sign in to comment.