Skip to content

Commit

Permalink
Fix issue reported by OSS-Fuzz (https://bugs.chromium.org/p/oss-fuzz/…
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder authored Jan 4, 2024
1 parent 23f40d9 commit 7691e4e
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ public int getTextOffset() throws IOException {
@Override
public BigInteger getBigIntegerValue() throws IOException {
_verifyIsNumberToken();
return _getBigIntegerValue();
}

// @since 2.17
private BigInteger _getBigIntegerValue() throws IOException {
try {
return _reader.bigIntegerValue();
} catch (IonException | ArrayIndexOutOfBoundsException e) {
Expand All @@ -341,6 +346,11 @@ public BigInteger getBigIntegerValue() throws IOException {
public BigDecimal getDecimalValue() throws IOException {

_verifyIsNumberToken();
return _getBigDecimalValue();
}

// @since 2.17
private BigDecimal _getBigDecimalValue() throws IOException {
try {
return _reader.bigDecimalValue();
} catch (IonException | ArrayIndexOutOfBoundsException e) {
Expand Down Expand Up @@ -446,9 +456,9 @@ public Number getNumberValue() throws IOException {
case DOUBLE:
return _reader.doubleValue();
case BIG_DECIMAL:
return _reader.bigDecimalValue();
return _getBigDecimalValue();
case BIG_INTEGER:
return getBigIntegerValue();
return _getBigIntegerValue();
}
}
return null;
Expand Down

0 comments on commit 7691e4e

Please sign in to comment.