diff options
author | Taylor Blau <me@ttaylorr.com> | 2023-07-13 02:37:52 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-14 19:32:03 +0300 |
commit | 0948c501761585bdf3e4e1133700c2eb867d88e6 (patch) | |
tree | 32002a750880b2e9a479ad463ee7d378d048ea17 /commit-graph.c | |
parent | d67609bdded151d78522911629c9e7da7fd06640 (diff) |
pack-bitmap.c: ensure that eindex lookups don't overflow
When a bitmap is used to answer some reachability query, it creates a
pseudo-bitmap called the "extended index" on top of any existing bitmaps
to store objects that are relevant to the query, but not mentioned in
the bitmap.
When looking up the ith object in the extended index in a bitmap, it is
common to write something like:
bitmap_get(result, i + bitmap_num_objects(bitmap_git))
, indicating that we want the ith object following all other objects
mentioned in the bitmap_git.
Since the type of `i` and the return type of `bitmap_num_objects()` are
both `uint32_t`s, But if there are either a large number of objects in
the bitmap, or a large number of objects in the extended index (or
both), this addition can overflow when the sum is greater than 2^32-1.
Having that large of a bitmap position is entirely acceptable, but we
need to ensure that the computed bitmap position for that object is
performed using 64-bits and doesn't overflow.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions