diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-08-27 21:28:08 +0200 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-08-27 21:28:08 +0200 |
commit | ba90f0109f0e327954487f86e7340f1ea9b429fc (patch) | |
tree | 45e8748d7f0a86c23a75e72756cb210ca98c848e | |
parent | 891e74978ea10f04c2d59339901f04292cea3e4f (diff) | |
download | fuzzer-ba90f0109f0e327954487f86e7340f1ea9b429fc.tar.gz |
check we have sufficient bytes to continue, fix for nevsky
-rwxr-xr-x | rtt-module.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rtt-module.js b/rtt-module.js index a0df345..a12f520 100755 --- a/rtt-module.js +++ b/rtt-module.js @@ -14,6 +14,10 @@ const RULES = require(RULES_JS_FILE) module.exports.fuzz = function(fuzzerInputData) { let data = new FuzzedDataProvider(fuzzerInputData) + if (data.remainingBytes < 16) { + // insufficient bytes to start + return + } let seed = data.consumeIntegralInRange(1, 2**35-31) let scenario = data.pickValue(RULES.scenarios) @@ -30,6 +34,10 @@ module.exports.fuzz = function(fuzzerInputData) { let step = 0 while (true) { + if (data.remainingBytes < 16) { + // insufficient bytes to continue + return + } let active = state.active if (active === 'Both' || active === 'All') { // If multiple players can act, we'll pick a random player to go first. @@ -58,8 +66,9 @@ module.exports.fuzz = function(fuzzerInputData) { } // Tor: view.actions["foo"] === 0 means the "foo" action is disabled (show the button in a disabled state) + // Also ignoring the actions with `[]` as args, unsure about this but needed for Nevsky. for (const [key, value] of Object.entries(actions)) { - if (value === false || value === 0) { + if (value === false || value === 0 || value.length === 0) { delete actions[key] } } |