summaryrefslogtreecommitdiff
path: root/notes-merge.h
diff options
context:
space:
mode:
authorLibravatar Taylor Blau <me@ttaylorr.com>2021-03-05 10:21:56 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-05 11:33:52 -0800
commit2a15964128edd08278efeacc75e75c77cfdde77e (patch)
treefb84aacc8e8cf1b8a9e52f94931a20bde949d079 /notes-merge.h
parentbuiltin/repack.c: assign pack split later (diff)
downloadtgif-2a15964128edd08278efeacc75e75c77cfdde77e.tar.xz
builtin/repack.c: be more conservative with unsigned overflows
There are a number of places in the geometric repack code where we multiply the number of objects in a pack by another unsigned value. We trust that the number of objects in a pack is always representable by a uint32_t, but we don't necessarily trust that that number can be multiplied without overflow. Sprinkle some unsigned_add_overflows() and unsigned_mult_overflows() in split_pack_geometry() to check that we never overflow any unsigned types when adding or multiplying them. Arguably these checks are a little too conservative, and certainly they do not help the readability of this function. But they are serving a useful purpose, so I think they are worthwhile overall. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes-merge.h')
0 files changed, 0 insertions, 0 deletions