summaryrefslogtreecommitdiff
path: root/perl/FromCPAN/.gitattributes
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2018-09-18 23:49:07 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-09-19 12:03:35 -0700
commit2fa233a5541d643d1adae43bcac62226cb20d92d (patch)
treeb1f549999f61405802bfc73522867b7d5043b423 /perl/FromCPAN/.gitattributes
parentMerge branch 'cc/delta-islands' (diff)
downloadtgif-2fa233a5541d643d1adae43bcac62226cb20d92d.tar.xz
pack-objects: handle island check for "external" delta base
Two recent topics, jk/pack-delta-reuse-with-bitmap and cc/delta-islands, can have a funny interaction. When checking if we can reuse an on-disk delta, the first topic allows base_entry to be NULL when we find an object that's not in the packing list. But the latter topic introduces a call to in_same_island(), which needs to look at base_entry->idx.oid. When these two features are used together, we might try to dereference a NULL base_entry. In practice, this doesn't really happen. We'd generally only use delta islands when packing to disk, since the whole point is to optimize the pack for serving fetches later. And the new delta-reuse code relies on having used reachability bitmaps to determine the set of objects, which we would typically only do when serving an actual fetch. However, it is technically possible to combine these features. And even without doing so, building with "SANITIZE=address,undefined" will cause t5310.46 to complain. Even though that test does not have delta islands enabled, we still take the address of the NULL entry to pass to in_same_island(). That function then promptly returns without dereferencing the value when it sees that islands are not enabled, but it's enough to trigger a sanitizer error. The solution is straight-forward: when both features are used together, we should pass the oid of the found base to in_same_island(). This is tricky to do inside a single "if" statement. And after the merge in f3504ea3dd (Merge branch 'cc/delta-islands', 2018-09-17), that "if" condition is already getting pretty unwieldy. So this patch moves the logic into a helper function, where we can easily use multiple return paths. The result is a bit longer, but the logic should be much easier to follow. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl/FromCPAN/.gitattributes')
0 files changed, 0 insertions, 0 deletions