Skip to content

Commit fb855c0

Browse files
authored
Add not-failing test that tries to reproduce #473: has the data but call sequence not same as OSS-Fuzzer (#474)
1 parent c57f7be commit fb855c0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.fasterxml.jackson.dataformat.ion.failing;
2+
3+
import org.hamcrest.Matchers;
4+
import org.junit.Test;
5+
6+
import com.fasterxml.jackson.core.JsonParser;
7+
import com.fasterxml.jackson.core.JsonToken;
8+
import com.fasterxml.jackson.core.exc.StreamReadException;
9+
import com.fasterxml.jackson.databind.ObjectMapper;
10+
import com.fasterxml.jackson.dataformat.ion.*;
11+
12+
import static org.hamcrest.MatcherAssert.assertThat;
13+
import static org.junit.Assert.assertEquals;
14+
import static org.junit.Assert.fail;
15+
16+
//[dataformats-binary#473]: ArrayIndexOutOfBoundsException
17+
//https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66131
18+
public class IonFuzz_473_66131_AIOOBE_Test
19+
{
20+
private final ObjectMapper ION_MAPPER = new IonObjectMapper();
21+
22+
@Test
23+
public void testFuzz66077_ArrayIndexOOBE() throws Exception {
24+
final byte[] doc = { (byte) 0xe0, 0x01, 0x00, (byte) 0xea, (byte) 0xdc, (byte) 0x9a };
25+
try (JsonParser p = ION_MAPPER.createParser(doc)) {
26+
assertEquals(JsonToken.START_OBJECT, p.nextToken());
27+
p.nextTextValue();
28+
fail("Should not pass (invalid content)");
29+
} catch (StreamReadException e) {
30+
assertThat(e.getMessage(), Matchers.containsString("Corrupt content to decode"));
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)