File tree 1 file changed +27
-0
lines changed
src/test/java/com/fasterxml/jackson/failing
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .core .*;
4
+ import com .fasterxml .jackson .core .exc .StreamReadException ;
5
+
6
+ public class JsonPointerOOME736Test extends BaseTest
7
+ {
8
+ // such as https://github.com/nst/JSONTestSuite/blob/master/test_parsing/n_structure_100000_opening_arrays.json
9
+ public void testDeepJsonPointer () throws Exception {
10
+ int MAX_DEPTH = 100000 ;
11
+ String INPUT = new String (new char [MAX_DEPTH ]).replace ("\0 " , "[" );
12
+ JsonParser parser = createParser (MODE_READER , INPUT );
13
+ try {
14
+ while (true ) {
15
+ parser .nextToken ();
16
+ }
17
+ } catch (StreamReadException e ) {
18
+ verifyException (e , "Unexpected end" );
19
+ JsonStreamContext parsingContext = parser .getParsingContext ();
20
+ JsonPointer jsonPointer = parsingContext .pathAsPointer (); // OOME
21
+ String pointer = jsonPointer .toString ();
22
+ String expected = new String (new char [MAX_DEPTH - 1 ]).replace ("\0 " , "/0" );
23
+ assertEquals (expected , pointer );
24
+ }
25
+ parser .close ();
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments