FILE_METADATA_WIRE_SIZE is not portable between 32-bit and 64-bit systems #51
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
In
src/shared/metadata.hline 8-9,FILE_METADATA_WIRE_SIZEis computed based on compile-time type sizes:Type sizes differ between architectures:
The metadata wire format uses
metadata_to_buf/metadata_from_bufwhich serializes/deserializes these types directly withmemcpy. If a 32-bit client communicates with a 64-bit server, the metadata wire format will be interpreted differently, causing data corruption or crashes.Location
src/shared/metadata.h:8-9,src/shared/metadata.c:11-47Suggested Fix
Use fixed-width integer types for the wire format instead of relying on
sizeof()for native types. Define explicit wire-format fields:Then explicitly cast or convert each field when serializing and deserializing.
Severity
High
Category
Bug