Skip to content

Commit

Permalink
minor comment improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 26, 2022
1 parent d4d97a6 commit f3f1f78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/fasterxml/jackson/core/JsonPointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ public static JsonPointer forPath(JsonStreamContext context,
if (context == null) {
return EMPTY;
}
// Otherwise if context was just created but is not advanced -- like,
// opening START_ARRAY/START_OBJECT returned -- drop the empty context.
if (!context.hasPathSegment()) {
// one special case; do not prune root if we need it
// Except one special case: do not prune root if we need it
if (!(includeRoot && context.inRoot() && context.hasCurrentIndex())) {
context = context.getParent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class JsonPointerOOME736Test extends BaseTest
// such as https://github.com/nst/JSONTestSuite/blob/master/test_parsing/n_structure_100000_opening_arrays.json
public void testDeepJsonPointer() throws Exception {
int MAX_DEPTH = 100000;
// Create nesting of 100k arrays
String INPUT = new String(new char[MAX_DEPTH]).replace("\0", "[");
JsonParser parser = createParser(MODE_READER, INPUT);
try {
Expand Down

0 comments on commit f3f1f78

Please sign in to comment.