-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
json::to_bson does not handle unsigned 64 bit integers #3894
Labels
aspect: binary formats
BSON, CBOR, MessagePack, UBJSON
confirmed
kind: bug
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Milestone
Comments
It seems I was confused with the alias "timestamp" when I implemented BSON. You are right - it makes no sense to not support uint64 numbers. An extension should be straightforward, but to do it properly with tests may take some time. |
@nlohmann Can I raise a PR for this? |
Sure! |
This was referenced May 24, 2024
Sorry for the delay. I added some comments. |
nlohmann
added
the
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
label
Nov 17, 2024
2 tasks
Fixed by merging #4590. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
aspect: binary formats
BSON, CBOR, MessagePack, UBJSON
confirmed
kind: bug
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Description
Trying to convert a nlohmann::json object which contains an unsigned int of 64 bit length breaks BSON conversion.
I do consider this to be a bug, as BSON should be capable of handling those values [1] , but the corresponding header-bits are not set in write_bson_unsigned. Only entry headers
0x10
(forint32
) and0x12
(forint64
) are written, but11
(foruint_64
) is not.Reproduction steps
This bug is triggered whenever one uses the
json::to_bson
function on any object that contains an uint64_t, that really uses all 64 bits.Expected vs. actual results
I expect BSON to generated, but I get an error message (see below)
Minimal code example
Error messages
Compiler and operating system
Clang-13 on Mint 21 64bit, Clang Trunk (via godbolt)
Library version
3.11.2 (develop branch via godbolt) , 3.10.5
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: