chunk_size truncated to int during wire transfer — values > 2GB silently corrupted #49
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/config.cline 113,config_send()castsconfig->chunk_size(anunsigned long long) tointfor transmission:The same truncation happens in the reverse direction on line 188:
And similarly for
delta_block_sizeon lines 123 and 203.Impact
If the user specifies
--chunk-size 3000000000(3GB, well withinunsigned long longrange), the value is silently truncated to a negative or garbageintbefore being sent over the wire. The receiving side gets an incorrect chunk size.While the default chunk size (10MB) and most practical values fit in
int, this is a latent correctness bug that violates the principle that the fullunsigned long longrange should be supported.Location
src/shared/config.c:113, 123, 188, 203Suggested Fix
Instead of
send_int/receive_int, usesend_n_data/receive_n_datawithsizeof(unsigned long long)to transmit these 64-bit values correctly:Severity
High
Category
Bug
This issue was automatically generated by the issue-creator agent.