Details
-
Bug
-
Resolution: Fixed
-
Major
-
2.5.0
-
Security Level: Public
-
None
-
Untriaged
-
Unknown
Description
The CRC checksum code in socio.cc looks like it will generate different checksums on big- and little-endian systems. Example code, at docio.cc:510:
crc = crc32_8((void *)&doc->length, sizeof(doc->length), 0);
doc->length is an integer so its byte layout varies by platform. It should be converted to big-endian form first before being added to the checksum.
This could create problems for mobile use, since ARM platforms are usually big-endian while x86 is little-endian. Developers sometimes create an initial populated database on PC and install it into the mobile app, to avoid syncing so much data on first launch.
It's also possible someone will use ForestDB as a document file format and want to transfer documents between systems of different endian-ness.