-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Bug in param TOC CRC calculation #192
Comments
Found a fondamental problems on how the toc are hashed! The code that calculate the CRC is: params = &_param_start;
paramsLen = &_param_stop - &_param_start;
paramsCrc = crcSlow(params, paramsLen*sizeof(params[0])); Looks simple enough, it does CRC the memory area that contains the full param toc. The problem is that when using objdump to look at this memory area this is what we see:
There is no strings at all! The toc contains structs that have pointer to strings and not the string content. The strings are in the object file that has declared the params, somewhere else in memory:
So, doing a checksum of the memory area containing the TOC is wrong: it only tests part of the TOC, basically the sequence of params and their types, but not the names. One solution is to hash the descriptions of each entry. The hash should represent all info that are sent to the ground, ideally no more but definitely no less! |
Fixed by using types and strings content in CRC calculation. Now if two TOC have the same hash, there is a big probability that it is the same TOC. |
There seems to be a bug with the param TOC CRC calculation. The bug was discovered in this ticket in the client bitcraze/crazyflie-clients-python#281. The CRC is used by the client to cache the TOC and the CRC calculation seems unreliable. Running some test I have observed 2 problematic behaviors:
In the process the log TOC CRC should also be checked.
The text was updated successfully, but these errors were encountered: