-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
cbor/src/test/java/tools/jackson/dataformat/cbor/failing/Fuzz_65617_Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package tools.jackson.dataformat.cbor.failing; | ||
|
||
import tools.jackson.core.JsonParser; | ||
import tools.jackson.core.JsonToken; | ||
import tools.jackson.core.exc.StreamReadException; | ||
|
||
import tools.jackson.databind.ObjectMapper; | ||
|
||
import tools.jackson.dataformat.cbor.CBORTestBase; | ||
|
||
// Trying to reproduce | ||
// | ||
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?65617 | ||
// | ||
// but does not quite fail the way Fuzzer does (AIOOBE on nextToken when | ||
// skipping VALUE_EMBEDDED_OBJECT | ||
public class Fuzz_65617_Test extends CBORTestBase | ||
{ | ||
private final ObjectMapper MAPPER = cborMapper(); | ||
|
||
// [dataformats-binary#???] | ||
// | ||
public void testFuzzCase65617() throws Exception | ||
{ | ||
final byte[] input = readResource("/data/clusterfuzz-cbor-65617.cbor"); | ||
// try (JsonParser p = MAPPER.createParser(new java.io.ByteArrayInputStream(input))) { | ||
try (JsonParser p = MAPPER.createParser(input)) { | ||
assertToken(JsonToken.START_ARRAY, p.nextToken()); | ||
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); | ||
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); | ||
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); | ||
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); | ||
assertToken(JsonToken.VALUE_EMBEDDED_OBJECT, p.nextToken()); | ||
// Should we access alleged byte[] or skip? | ||
// p.getBinaryValue(); | ||
assertToken(JsonToken.END_ARRAY, p.nextToken()); | ||
fail("Should not pass"); | ||
} catch (StreamReadException e) { | ||
verifyException(e, "Invalid CBOR value token (first byte): 0x5d"); | ||
} | ||
} | ||
} |
Binary file not shown.