summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-05-02 16:49:59 +0200
committerPatrick Steinhardt <ps@pks.im>2016-05-02 17:45:24 +0200
commit153fde5b4349f12de4f152c26d3b298e58a69cd8 (patch)
tree50b647018b160908b90f7ec46c810459b9870253 /src/commit.c
parent7f407710ef5d46b18ee68f7f6580e593ee486bb4 (diff)
downloadlibgit2-153fde5b4349f12de4f152c26d3b298e58a69cd8.tar.gz
delta-apply: fix sign extension
We compute offsets by executing `off |= (*delta++ << 24)` for multiple constants, where `off` is of type `size_t` and `delta` is of type `unsigned char`. The usual arithmetic conversions (see ISO C89 ยง3.2.1.5 "Usual arithmetic conversions") kick in here, causing us to promote both operands to `int` and then extending the result to an `unsigned long` when OR'ing it with `off`. The integer promotion to `int` may result in wrong size calculations for big values. Fix the issue by making the constants `unsigned long`, causing both operands to be promoted to `unsigned long`.
Diffstat (limited to 'src/commit.c')
0 files changed, 0 insertions, 0 deletions