diff --git a/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java index 8e0aeec704..ecfb7dedce 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java +++ b/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java @@ -2016,7 +2016,7 @@ private final String parseName(int q1, int ch, int lastQuadBytes) throws IOExcep private int[] growArrayWithNameLenCheck(int[] arr, int more) throws StreamConstraintsException { // the following check will fail if the array is already bigger than is allowed for names - _streamReadConstraints.validateNameLength(arr.length); + _streamReadConstraints.validateNameLength(arr.length << 2); return growArrayBy(_quadBuffer, more); } @@ -2118,7 +2118,7 @@ protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int } quads[qlen++] = _padLastQuad(currQuad, currQuadBytes); } - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { name = addName(quads, qlen, currQuadBytes); @@ -2199,7 +2199,7 @@ protected String _handleOddName(int ch) throws IOException } quads[qlen++] = currQuad; } - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { name = addName(quads, qlen, currQuadBytes); @@ -2305,7 +2305,7 @@ protected String _parseAposName() throws IOException } quads[qlen++] = _padLastQuad(currQuad, currQuadBytes); } - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { name = addName(quads, qlen, currQuadBytes); @@ -2370,7 +2370,7 @@ private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadB _quadBuffer = quads = growArrayWithNameLenCheck(quads, quads.length); } quads[qlen++] = _padLastQuad(lastQuad, lastQuadBytes); - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { return addName(quads, qlen, lastQuadBytes); diff --git a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java index f41c65a4a7..4c5c328ef9 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java +++ b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.java @@ -2176,7 +2176,7 @@ private final JsonToken _parseEscapedName(int qlen, int currQuad, int currQuadBy } else if (qlen == 0) { // rare, but may happen return _fieldComplete(""); } - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { name = _addName(quads, qlen, currQuadBytes); @@ -2275,7 +2275,7 @@ private JsonToken _finishUnquotedName(int qlen, int currQuad, int currQuadBytes) } quads[qlen++] = currQuad; } - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { name = _addName(quads, qlen, currQuadBytes); @@ -2373,7 +2373,7 @@ private JsonToken _finishAposName(int qlen, int currQuad, int currQuadBytes) } else if (qlen == 0) { // rare case but possible return _fieldComplete(""); } - _streamReadConstraints.validateNameLength(qlen); + _streamReadConstraints.validateNameLength(qlen << 2); String name = _symbols.findName(quads, qlen); if (name == null) { name = _addName(quads, qlen, currQuadBytes); @@ -2435,7 +2435,7 @@ protected final JsonToken _finishFieldWithEscape() throws IOException private int[] growArrayWithNameLenCheck(int[] arr, int more) throws StreamConstraintsException { // the following check will fail if the array is already bigger than is allowed for names - _streamReadConstraints.validateNameLength(arr.length); + _streamReadConstraints.validateNameLength(arr.length << 2); return growArrayBy(_quadBuffer, more); }