-
-
Notifications
You must be signed in to change notification settings - Fork 141
Negative BigInteger
values not encoded/decoded correctly
#431
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
Comments
That sounds plausible to me. Thank you for reporting this @bgruber. But aside from confirming the case and proposing a fix, the tricky part is compatibility. |
I think I could use help here if anyone has time: I can help in configuration part, but would need a simple(st) reproduction for a small negative number (easiest to verify, handling not dependent on magnitude). |
@bgruber Is this something you could help with? I'd really like to address this for 2.18.0, but would need help. |
BigInteger
values not encoded/decoded correctly
Hi!
I was doing some work with the CBOR part of the library, and I found that it didn't decode or encode negative BigIntegers as I understand the spec. For example:
This prints out
c34101
, but per this CBOR playground, that's CBOR for a bigint of -2, not -1.Similarly on the read side:
Prints
1
, instead of-340282366920938463463374607431768211456
(-2^128). CBOR playgroundI think the issue is that the library is constructing the BigIntegers from the byte string, and then negating it, instead of taking the complement of the byte string (or "
-1 - n
" as stated by the RFC) and constructing the BigInteger from that.Thanks for all your work on jackson!
The text was updated successfully, but these errors were encountered: