Skip to content

Commit 8b1fcd5

Browse files
authored
Add a reproduction (failing unit test) for #471 (#472)
1 parent a68825a commit 8b1fcd5

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.exc.StreamReadException;
7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
import com.fasterxml.jackson.dataformat.ion.*;
9+
import com.fasterxml.jackson.dataformat.ion.fuzz.IonFuzzTestUtil;
10+
11+
import static org.hamcrest.MatcherAssert.assertThat;
12+
import static org.junit.Assert.fail;
13+
14+
// [dataformats-binary#471]: AssertionError for corrupt Timestamp
15+
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66141
16+
public class IonFuzz_471_66141_AssertionErrorTest
17+
{
18+
private final ObjectMapper ION_MAPPER = new IonObjectMapper();
19+
20+
@Test
21+
public void testFuzz66077_NegativeArraySize() throws Exception {
22+
final byte[] doc = IonFuzzTestUtil.readResource("/data/fuzz-66141.ion");
23+
try {
24+
ION_MAPPER.readValue(doc, java.util.Date.class);
25+
fail("Should not pass (invalid content)");
26+
} catch (StreamReadException e) {
27+
// May or may not be the exception message to get, change as appropriate
28+
assertThat(e.getMessage(), Matchers.containsString("Corrupt content to decode"));
29+
}
30+
}
31+
}
150 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)