Skip to content

Commit a925975

Browse files
authored
protobuf-js: pass a length to consumeString() (#13447)
`FuzzedDataProvider.consumeString()` expects a length [as its first argument](https://github.com/CodeIntelligenceTesting/jazzer.js/blob/592be5c6d7f453e96822be41fe3f2a1351b8fd96/packages/core/FuzzedDataProvider.ts#L435). There are two calls in the driver that omit this argument and crash. Pass in a random length instead, consistent with other calls to `consumeString()` in the driver.
1 parent 7ccdcf6 commit a925975

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/protobuf-js/fuzz.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const ignored = [
5555

5656
// Fuzz the Root#loadSync method
5757
function fuzzLoadSync(root, provider) {
58-
const filePath = provider.consumeString();
58+
const filePath = provider.consumeString(provider.consumeIntegralInRange(1, 64));
5959
root.loadSync(filePath);
6060
}
6161

@@ -75,7 +75,7 @@ function fuzzLookupType(root, provider) {
7575

7676
// Fuzz the Message#encode method
7777
function fuzzEncode(root, provider) {
78-
const typeName = provider.consumeString();
78+
const typeName = provider.consumeString(provider.consumeIntegralInRange(1, 64));
7979
const message = root.create(typeName);
8080

8181
// Construct the input for the message instance manually

0 commit comments

Comments
 (0)