Closed
Description
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.core.JsonToken;
import java.io.IOException;
public class Test {
public static void main(String[] args) {
String content = ",";
JsonFactory f = new JsonFactory().configure(Feature.ALLOW_MISSING_VALUES, true);
try {
JsonParser parser = f.createJsonParser(content);
JsonToken current = parser.nextToken();
// this will result in an infinite loop
while (parser.hasCurrentToken()) {
System.out.println(current); // prints VALUE_NULL
current = parser.nextToken();
}
} catch (IOException e) {
System.out.println(e);
}
}
}
This code results in an infinite loop. Only happens with ALLOW_MISSING_VALUES enabled. Treats the unexpected comma as a missing value or something, replacing it with NULL, but on the top-level this results in an infinite loop where nextToken() will return VALUE_NULL forever.
Also happens on inputs including:
- [],
- {"foo": "bar"},
Metadata
Metadata
Assignees
Labels
No labels