Open terwilliger42 opened 6 years ago
Modify it to 1: bool some_bool
will fix it, I think it's not a bug
@ethe: In our case we have many thrift messages which all need to share a some common set of fields -- we give those IDs 1, 2, 3, 4, 5 etc... and then require the fields which are not common to start at 20, so that there aren't conflicts.
AFAIK the thrift spec doesn't say that you can't skip IDs. If I change the type to an int16 or any other type other than bool, it will work just fine. If this is not allowed, an exception should be raised rather than causing corrupt messages.
We use thriftpy, I appreciate all of the work that has been done thus far and am glad to see it will get a little more attention going forward.
Looks like if you have a bool in your struct and you're writing using Compact format, it's very likely the resulting message will be corrupt. See attached testcase.
This occurs due to this piece of code -- the "else" clause does not write out the field ID.
In a practical sense, this may occur if the last field ID written out is more than 15 IDs away, but consider this:
corrupt_bool_testcase.txt