Skip to content

Commit a854f14

Browse files
committed
Fix #1169
1 parent 3444205 commit a854f14

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ a pure JSON library.
1818

1919
#1157: Use fast parser (FDP) for large `BigDecimal`s (500+ chars)
2020
(contributed by @pjfanning)
21+
#1169: `ArrayIndexOutOfBoundsException` for specific invalid content,
22+
with Reader-based parser
2123

2224
2.16.1 (not yet released)
2325

src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1582,8 +1582,7 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws IOExcept
15821582
// This is the place to do leading-zero check(s) too:
15831583
int intLen = 0;
15841584
char c = (_inputPtr < _inputEnd) ? _inputBuffer[_inputPtr++]
1585-
: getNextChar("No digit following minus sign", JsonToken.VALUE_NUMBER_INT);
1586-
1585+
: getNextChar("No digit following sign", JsonToken.VALUE_NUMBER_INT);
15871586
if (c == '0') {
15881587
c = _verifyNoLeadingZeroes();
15891588
}
@@ -1609,7 +1608,7 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws IOExcept
16091608
// Also, integer part is not optional
16101609
if (intLen == 0) {
16111610
// [core#611]: allow optionally leading decimal point
1612-
if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) {
1611+
if ((c != '.') || !isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) {
16131612
return _handleInvalidNumberStart(c, neg);
16141613
}
16151614
}

src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz61198_1169_NumberParseTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ private void _testLeadingPlusMalformed(JsonFactory f, int mode) throws Exception
3838
JsonToken t = p.nextToken();
3939
assertToken(JsonToken.VALUE_NUMBER_INT, t);
4040
// Either one works:
41-
4241
// p.getNumberType();
4342
p.getIntValue();
4443
fail("Should not pass, got: "+t);

0 commit comments

Comments
 (0)