Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update IonFuzz_473_66131_AIOOBE_Test to provoke an ArrayIndexOutOfBoundsException #477

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.ion.*;
import com.fasterxml.jackson.dataformat.ion.fuzz.IonFuzzTestUtil;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;

//[dataformats-binary#473]: ArrayIndexOutOfBoundsException
Expand All @@ -23,13 +21,12 @@ public class IonFuzz_473_66131_AIOOBE_Test

@Test
public void testFuzz66077_ArrayIndexOOBE() throws Exception {
final byte[] doc = IonFuzzTestUtil.readResource("/data/fuzz-66131.ion");
final byte[] doc = { (byte) 0xe0, 0x01, 0x00, (byte) 0xea, (byte) 0xdc, (byte) 0x9a };
try (JsonParser p = ION_MAPPER.createParser(doc)) {
assertEquals(JsonToken.VALUE_STRING, p.nextToken());
assertNull(p.nextToken());
assertEquals(JsonToken.START_OBJECT, p.nextToken());
p.nextTextValue();
fail("Should not pass (invalid content)");
} catch (StreamReadException e) {
// May or may not be the exception message to get, change as appropriate
assertThat(e.getMessage(), Matchers.containsString("Corrupt content to decode"));
}
}
Expand Down
Binary file removed ion/src/test/resources/data/fuzz-66131.ion
Binary file not shown.