File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed
main/java/com/fasterxml/jackson/dataformat/ion
java/com/fasterxml/jackson/dataformat/ion/fuzz Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -550,6 +550,12 @@ public JsonToken nextToken() throws IOException
550
550
type = _reader .next ();
551
551
} catch (IonException e ) {
552
552
_wrapError (e .getMessage (), e );
553
+
554
+ // [dataformats-binary#420]: IonJava leaks IOOBEs so:
555
+ } catch (IndexOutOfBoundsException e ) {
556
+ _wrapError (String .format ("Corrupt content to decode; underlying failure: (%s) %s" ,
557
+ e .getClass ().getName (), e .getMessage ()),
558
+ e );
553
559
}
554
560
if (type == null ) {
555
561
if (_parsingContext .inRoot ()) { // EOF?
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .ion .fuzz ;
2
+
3
+ import java .io .InputStream ;
4
+
5
+ import org .hamcrest .Matchers ;
6
+ import org .junit .Test ;
7
+
8
+ import com .fasterxml .jackson .core .exc .StreamReadException ;
9
+ import com .fasterxml .jackson .dataformat .ion .*;
10
+
11
+ import static org .hamcrest .MatcherAssert .assertThat ;
12
+ import static org .junit .Assert .fail ;
13
+
14
+ // [dataformats-binary#420]
15
+ public class Fuzz420_65062_65083IOOBETest
16
+ {
17
+ @ Test
18
+ public void testFuzz6506265083IOOBE () throws Exception {
19
+ IonFactory f = IonFactory
20
+ .builderForTextualWriters ()
21
+ .enable (IonParser .Feature .USE_NATIVE_TYPE_ID )
22
+ .build ();
23
+ IonObjectMapper mapper = IonObjectMapper .builder (f ).build ();
24
+ try (InputStream in = getClass ().getResourceAsStream ("/data/fuzz-420.ion" )) {
25
+ mapper .readTree (in );
26
+ fail ("Should not pass (invalid content)" );
27
+ } catch (StreamReadException e ) {
28
+ assertThat (e .getMessage (), Matchers .containsString ("Corrupt content to decode" ));
29
+ }
30
+ }
31
+ }
Original file line number Diff line number Diff line change @@ -285,3 +285,5 @@ Arthur Chan (@arthurscchan)
285
285
* Contributed #417 : (ion) `IonReader` classes contain assert statement which could throw
286
286
unexpected `AssertionError `
287
287
(2.17 .0 )
288
+ * Contributed #420 : (ion) `IndexOutOfBoundsException` thrown by `IonReader` implementations
289
+ (2.17 .0 )
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ Active maintainers:
19
19
#417 : (ion ) `IonReader ` classes contain assert statement which could throw
20
20
unexpected `AssertionError `
21
21
(contributed by Arthur C )
22
+ #420 : (ion) `IndexOutOfBoundsException` thrown by `IonReader` implementations
23
+ are not handled
24
+ (contributed by Arthur C )
22
25
- (ion ) Update `com .amazon .ion :ion - java ` to 1.11 .0 (from 1.10 .5 )
23
26
24
27
2.16 .0 (15 - Nov - 2023 )
You can’t perform that action at this time.
0 commit comments