You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Daniel,
First: Great work with this library, exactly what I needed! Keep it up! 🎉
Today I wanted to export some BSON with the extension and noticed, that the other side (reading the bson) ran into trouble. After drilling down on the issue, I found a slight mistake in the encoder's visit_int64 method.
In the original one, it selects based on the tag, if it puts the identifier of jsoncons::bson::detail::bson_format::int64_cd or jsoncons::bson::detail::bson_format::datetime_cd into the buffer and then decides if the number fits into 32 or 64 bits. If it then decides to write only 32 bits, the identifier is already written and the other side expects 64 bits.
I would suggest altering the code like so: (This is only tested in my own project so far, please verify!)
Thanks for reporting this, I've incorporated your proposed changes into master. Clearly we didn't have enough test cases, no coverage for int32. I've added some tests from the mongodb/libbson test suite that cover null, bool, int32, int64, double, utf8 string, binary, document, and array, which all pass.
Hello Daniel,
First: Great work with this library, exactly what I needed! Keep it up! 🎉
Today I wanted to export some BSON with the extension and noticed, that the other side (reading the bson) ran into trouble. After drilling down on the issue, I found a slight mistake in the encoder's visit_int64 method.
In the original one, it selects based on the tag, if it puts the identifier of
jsoncons::bson::detail::bson_format::int64_cd
orjsoncons::bson::detail::bson_format::datetime_cd
into the buffer and then decides if the number fits into 32 or 64 bits. If it then decides to write only 32 bits, the identifier is already written and the other side expects 64 bits.I would suggest altering the code like so: (This is only tested in my own project so far, please verify!)
The same problem also occurs with the visit_uint64 method, which can be fixed in the same manner:
The text was updated successfully, but these errors were encountered: