From 4c99e9ed504dbc23a41e80702ca237925bbc0be8 Mon Sep 17 00:00:00 2001 From: Jonathan Lai Date: Mon, 3 Oct 2022 17:51:09 -0400 Subject: [PATCH] fix build errors --- bcrypt.js | 6 +++++- binding.gyp | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bcrypt.js b/bcrypt.js index 7fc281c4..dd8aed06 100644 --- a/bcrypt.js +++ b/bcrypt.js @@ -87,10 +87,14 @@ module.exports.genSalt = function genSalt(rounds, minor, cb) { /// @param {String} salt the salt to use when hashing /// @return {String} hash module.exports.hashSync = function hashSync(data, salt) { + if (data == null || salt == null) { throw new Error('data and salt arguments required'); } - + + if (salt === '') { + throw new Error('Salt cannot be empty'); + } if (typeof data !== 'string' || (typeof salt !== 'string' && typeof salt !== 'number')) { throw new Error('data must be a string and salt must either be a salt string or a number of rounds'); } diff --git a/binding.gyp b/binding.gyp index 10b4b9d7..181dca0f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -38,10 +38,11 @@ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden } }], - ['OS=="zos" and NODE_VERSION < 16',{ + ['OS=="zos" and NODE_VERSION <= 16',{ 'cflags': [ '-qascii', ], + 'defines': ["NAPI_DISABLE_CPP_EXCEPTIONS"], }], ], },