Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigInteger scale limit checks for Integer.MAX_VALUE and Integer.MIN_VALUE #104

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions impl/src/main/java/org/eclipse/parsson/JsonNumberImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public double doubleValue() {
@Override
public BigInteger bigIntegerValue() {
BigDecimal bd = bigDecimalValue();
if (Math.abs(bd.scale()) <= bigIntegerScaleLimit) {
if (Math.abs(bd.scale()) <= bigIntegerScaleLimit && Integer.MIN_VALUE < bd.scale() && Integer.MAX_VALUE > bd.scale()) {
return bd.toBigInteger();
}
throw new UnsupportedOperationException(
Expand All @@ -297,7 +297,7 @@ public BigInteger bigIntegerValue() {
@Override
public BigInteger bigIntegerValueExact() {
BigDecimal bd = bigDecimalValue();
if (Math.abs(bd.scale()) <= bigIntegerScaleLimit) {
if (Math.abs(bd.scale()) <= bigIntegerScaleLimit && Integer.MIN_VALUE < bd.scale() && Integer.MAX_VALUE > bd.scale()) {
return bd.toBigIntegerExact();
}
throw new UnsupportedOperationException(
Expand Down
Loading