• Nicolas Pitre's avatar
    avoid possible overflow in delta size filtering computation · 720fe22d
    Nicolas Pitre authored
    On a 32-bit system, the maximum possible size for an object is less than
    4GB, while 64-bit systems may cope with larger objects.  Due to this
    limitation, variables holding object sizes are using an unsigned long
    type (32 bits on 32-bit systems, or 64 bits on 64-bit systems).
    
    When large objects are encountered, and/or people play with large delta
    depth values, it is possible for the maximum allowed delta size
    computation to overflow, especially on a 32-bit system.  When this
    occurs, surviving result bits may represent a value much smaller than
    what it is supposed to be, or even zero.  This prevents some objects
    from being deltified although they do get deltified when a smaller depth
    limit is used.  Fix this by always performing a 64-bit multiplication.
    Signed-off-by: default avatarNicolas Pitre <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
    720fe22d
builtin-pack-objects.c 56.8 KB