-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
performanceIssue related to performance problems or enhancementsIssue related to performance problems or enhancements
Milestone
Description
Describe the bug
After parsing a deeply nested JSON input stream to an ObjectMapper the returned JsonNode
throws a StackOverflowError for toString()
.
Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate com.fasterxml.jackson.databind.node.ObjectNode.toString()
Version information
2.13.2.2
To Reproduce
int depth = 50000;
StringBuilder jsonString = new StringBuilder();
jsonString.append("{");
for (int i=0; i < depth; i++) {
jsonString.append(String.format("\"abc%s\": {", i));
}
for (int i=0; i < depth; i++) {
jsonString.append("}");
}
jsonString.append("}");
InputStream inputStream = new ByteArrayInputStream(jsonString.toString().getBytes(Charsets.UTF_8));
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(inputStream);
jsonNode.toString(); // throws StackOverflowError
Metadata
Metadata
Assignees
Labels
performanceIssue related to performance problems or enhancementsIssue related to performance problems or enhancements