File tree 5 files changed +52
-6
lines changed
main/java/com/fasterxml/jackson/dataformat/smile
java/com/fasterxml/jackson/dataformat/smile/fuzz
5 files changed +52
-6
lines changed Original file line number Diff line number Diff line change @@ -284,9 +284,11 @@ Simon Daudin (@simondaudin)
284
284
Arthur Chan (@arthurscchan )
285
285
* Contributed #417 : (ion) `IonReader` classes contain assert statement which could throw
286
286
unexpected `AssertionError `
287
- (2.17 .0 )
287
+ (2.17 .0 )
288
288
* Contributed #420 : (ion) `IndexOutOfBoundsException` thrown by `IonReader` implementations
289
- (2.17 .0 )
289
+ (2.17 .0 )
290
290
* Contributed #424 : (ion) `IonReader` throws `NullPointerException` for unchecked
291
291
invalid data
292
- (2.17 .0 )
292
+ (2.17 .0 )
293
+ * Contributed #426 : (smile) `SmileParser` throws unexpected IOOBE for corrupt content
294
+ (2.17 .0 )
Original file line number Diff line number Diff line change @@ -18,12 +18,14 @@ Active maintainers:
18
18
19
19
#417 : (ion ) `IonReader ` classes contain assert statement which could throw
20
20
unexpected `AssertionError `
21
- (contributed by Arthur C )
21
+ (fix contributed by Arthur C )
22
22
#420 : (ion) `IndexOutOfBoundsException` thrown by `IonReader` implementations
23
23
are not handled
24
- (contributed by Arthur C )
24
+ (fix contributed by Arthur C )
25
25
#424 : (ion) `IonReader` throws `NullPointerException` for unchecked invalid data
26
- (contributed by Arthur C )
26
+ (fix contributed by Arthur C )
27
+ #426 : (smile) `SmileParser` throws unexpected IOOBE for corrupt content
28
+ (fix contributed by Arthur C )
27
29
- (ion ) Update `com .amazon .ion :ion - java ` to 1.11 .0 (from 1.10 .5 )
28
30
29
31
2.16 .0 (15 - Nov - 2023 )
Original file line number Diff line number Diff line change @@ -2893,6 +2893,11 @@ protected void _skipIncomplete() throws IOException
2893
2893
2894
2894
protected void _skipBytes (int len ) throws IOException
2895
2895
{
2896
+ // 18-Dec-2023, tatu: Sanity check related to some OSS-Fuzz findings:
2897
+ if (len < 0 ) {
2898
+ throw _constructReadException ("Internal error: _skipBytes() called with negative value: %d" ,
2899
+ len );
2900
+ }
2896
2901
while (true ) {
2897
2902
int toAdd = Math .min (len , _inputEnd - _inputPtr );
2898
2903
_inputPtr += toAdd ;
@@ -2914,6 +2919,15 @@ protected void _skip7BitBinary() throws IOException
2914
2919
// Ok; 8 encoded bytes for 7 payload bytes first
2915
2920
int chunks = origBytes / 7 ;
2916
2921
int encBytes = chunks * 8 ;
2922
+
2923
+ // sanity check: not all length markers valid; due to signed int(32)
2924
+ // calculations maximum length only 7/8 of 2^31
2925
+ if (encBytes < 0 ) {
2926
+ throw _constructReadException (
2927
+ "Invalid content: invalid 7-bit binary encoded byte length (0x%X) exceeds maximum valid value" ,
2928
+ origBytes );
2929
+ }
2930
+
2917
2931
// and for last 0 - 6 bytes, last+1 (except none if no leftovers)
2918
2932
origBytes -= 7 * chunks ;
2919
2933
if (origBytes > 0 ) {
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .smile .fuzz ;
2
+
3
+ import com .fasterxml .jackson .core .*;
4
+ import com .fasterxml .jackson .core .exc .StreamReadException ;
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
6
+
7
+ import com .fasterxml .jackson .dataformat .smile .BaseTestForSmile ;
8
+
9
+ public class Fuzz_426_65126IOOBETest extends BaseTestForSmile
10
+ {
11
+ private final ObjectMapper MAPPER = smileMapper ();
12
+
13
+ // [dataformats-binary#426]
14
+ public void testInvalidIOOBE () throws Exception
15
+ {
16
+ final byte [] input = readResource ("/data/clusterfuzz-smile-65126.smile" );
17
+ try (JsonParser p = MAPPER .createParser (input )) {
18
+ assertNull (p .nextTextValue ());
19
+ assertToken (JsonToken .VALUE_EMBEDDED_OBJECT , p .currentToken ());
20
+ try {
21
+ p .nextTextValue ();
22
+ fail ("Should not pass" );
23
+ } catch (StreamReadException e ) {
24
+ verifyException (e , "Invalid content: invalid 7-bit binary encoded byte length" );
25
+ }
26
+ }
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments