File tree 3 files changed +37
-2
lines changed
main/java/com/fasterxml/jackson/dataformat/ion
java/com/fasterxml/jackson/dataformat/ion/fuzz
3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -593,8 +593,9 @@ public JsonToken nextToken() throws IOException
593
593
} catch (IonException e ) {
594
594
return _reportCorruptContent (e );
595
595
596
- } catch (IndexOutOfBoundsException | AssertionError e ) {
597
- // [dataformats-binary#420]: IonJava leaks IOOBEs so:
596
+ // } catch (AssertionError | IndexOutOfBoundsException | NullPointerException e) {
597
+ } catch (AssertionError | IndexOutOfBoundsException e ) {
598
+ // [dataformats-binary#420]: IonJava leaks IOOBEs, catch
598
599
// [dataformats-binary#432]: AssertionError if we're trying to get the text
599
600
// with a symbol id less than or equals to 0.
600
601
return _reportCorruptContent (e );
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .ion .fuzz ;
2
+
3
+ import java .io .*;
4
+
5
+ import org .hamcrest .Matchers ;
6
+ import org .junit .Test ;
7
+
8
+ import com .fasterxml .jackson .core .JsonParser ;
9
+ import com .fasterxml .jackson .core .JsonToken ;
10
+ import com .fasterxml .jackson .core .exc .StreamReadException ;
11
+ import com .fasterxml .jackson .databind .ObjectMapper ;
12
+ import com .fasterxml .jackson .dataformat .ion .*;
13
+
14
+ import static org .hamcrest .MatcherAssert .assertThat ;
15
+ import static org .junit .Assert .assertEquals ;
16
+ import static org .junit .Assert .fail ;
17
+
18
+ // [dataformats-binary#437]
19
+ public class Fuzz437_65452_NPETest
20
+ {
21
+ private final ObjectMapper ION_MAPPER = new IonObjectMapper ();
22
+
23
+ @ Test
24
+ public void testFuzz65452Eof () throws Exception {
25
+ try (InputStream in = getClass ().getResourceAsStream ("/data/fuzz-65452.ion" )) {
26
+ try (JsonParser p = ION_MAPPER .createParser (in )) {
27
+ assertEquals (JsonToken .VALUE_FALSE , p .nextToken ());
28
+ }
29
+ fail ("Should not pass (invalid content)" );
30
+ } catch (StreamReadException e ) {
31
+ assertThat (e .getMessage (), Matchers .containsString ("Corrupt content to decode" ));
32
+ }
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments