-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
CBOR loses Map
entries with specific long
Map key values (32-bit boundary)
#269
Comments
Quick question @Quantum64: which version? (2.12.2 ideally) |
It's 2.12.2. The issue only occurs with specific positive/negative key pairs that seem to be relatively rare. I have an algorithm that can generate an arbitrary number of them if you need more. This issue caused a very difficult to diagnose bug in our codebase as you might imagine. :) |
@Quantum64 yes, that sounds like an absolutely nightmare bug from user perspective. Thank you for reporting this: I'll have a look. Without looking I am guessing it'd have to do with auto-detection of smallest unit to use, and asymmetry b/w positive/negative 2-complement numbers (one more negative value than positive). And just speculating, right at boundary of 32-bit unsigned number. |
Oh. And it's Longs as keys... that's interesting. CBOR being different from JSON, Smile etc in allowing native non-String keys (which is a royal PITA to support but I digress :) ). |
I can reproduce this, and looks like this might actually be on generator side (... which is unfortunate). |
Map
entries with specific long
Map key values (32-bit boundary)
Ok it was two-part problem, actually. Partially there was incomplete fix wrt #30 for long-key case; partly missing handling on generator side. Fixed for upcoming 2.12.3, but backported in 2.11 branch too: just not sure if and how to release; so far was hoping to avoid releasing anything more from 2.11, but this bug might qualify. That should probably be a micro-patch but that gets bit trickier with multi-project repos. But first it'd be great if you could validate/verify the fix. I did push
of It'd be great to make sure this covers all cases: I did find couple of other ones beyond 2 values listed and think handling is fixed but better safe than sorry. |
I can confirm that we are no longer observing any issues on |
@Quantum64 thank you! I hope to release 2.12.3 within next 2 weeks, depending on whether other issues are found in near future. |
The issue only appears to occur with large keys of opposite sign. See the below reproducer.
This program produces the following output:
The text was updated successfully, but these errors were encountered: