File tree 3 files changed +34
-0
lines changed
main/java/com/fasterxml/jackson/dataformat/cbor
test/java/com/fasterxml/jackson/dataformat/cbor/fuzz 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -2697,6 +2697,11 @@ private final String _decodeShortName(int len) throws IOException
2697
2697
2698
2698
private final String _decodeLongerName (int len ) throws IOException
2699
2699
{
2700
+ // [dataformats-binary#288]: non-canonical length of 0 needs to be
2701
+ // dealt with
2702
+ if (len == 0 ) {
2703
+ return "" ;
2704
+ }
2700
2705
// Do we have enough buffered content to read?
2701
2706
if ((_inputEnd - _inputPtr ) < len ) {
2702
2707
// or if not, could we read?
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .cbor .fuzz ;
2
+
3
+ import com .fasterxml .jackson .core .JsonParser ;
4
+ import com .fasterxml .jackson .core .JsonToken ;
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
6
+ import com .fasterxml .jackson .dataformat .cbor .CBORTestBase ;
7
+
8
+ public class Fuzz288_35750_NonCanonicalNameTest extends CBORTestBase
9
+ {
10
+ private final ObjectMapper MAPPER = cborMapper ();
11
+
12
+ // [dataformats-binary#288]: non-canonical representation for length of 0
13
+ // causing ArrayOutOfBoundsException
14
+ public void testInvalidLongName () throws Exception
15
+ {
16
+ final byte [] input = new byte [] {
17
+ (byte ) 0x8A ,
18
+ (byte ) 0xAD , 0x7A , 0x00 ,
19
+ 0x00 , 0x00 , 0x00
20
+ };
21
+
22
+ try (JsonParser p = MAPPER .createParser (input )) {
23
+ assertToken (JsonToken .START_ARRAY , p .nextToken ());
24
+ assertToken (JsonToken .START_OBJECT , p .nextToken ());
25
+ assertToken (JsonToken .FIELD_NAME , p .nextToken ());
26
+ }
27
+ }
28
+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ Modules:
13
13
2.12 .4 (not yet released )
14
14
15
15
#287 : (cbor ) Uncaught exception in CBORParser ._nextChunkedByte2 (by ossfuzzer )
16
+ #288 : (cbor ) Uncaught exception in CBORParser ._findDecodedFromSymbols () (by ossfuzzer )
16
17
17
18
2.12 .3 (12 - Apr - 2021 )
18
19
You can’t perform that action at this time.
0 commit comments