-
-
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.
Add not-failing test that tries to reproduce #473: has the data but c…
…all sequence not same as OSS-Fuzzer (#474)
- Loading branch information
1 parent
c57f7be
commit fb855c0
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...test/java/com/fasterxml/jackson/dataformat/ion/failing/IonFuzz_473_66131_AIOOBE_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,33 @@ | ||
package com.fasterxml.jackson.dataformat.ion.failing; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.junit.Test; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.core.JsonToken; | ||
import com.fasterxml.jackson.core.exc.StreamReadException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.ion.*; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.fail; | ||
|
||
//[dataformats-binary#473]: ArrayIndexOutOfBoundsException | ||
//https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66131 | ||
public class IonFuzz_473_66131_AIOOBE_Test | ||
{ | ||
private final ObjectMapper ION_MAPPER = new IonObjectMapper(); | ||
|
||
@Test | ||
public void testFuzz66077_ArrayIndexOOBE() throws Exception { | ||
final byte[] doc = { (byte) 0xe0, 0x01, 0x00, (byte) 0xea, (byte) 0xdc, (byte) 0x9a }; | ||
try (JsonParser p = ION_MAPPER.createParser(doc)) { | ||
assertEquals(JsonToken.START_OBJECT, p.nextToken()); | ||
p.nextTextValue(); | ||
fail("Should not pass (invalid content)"); | ||
} catch (StreamReadException e) { | ||
assertThat(e.getMessage(), Matchers.containsString("Corrupt content to decode")); | ||
} | ||
} | ||
} |