aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2022-11-01 23:38:48 +0100
committerTomasz Kramkowski <tomasz@kramkow.ski>2022-11-02 00:25:22 +0100
commitb9c3014e6552253435af9a24122c87cf03bb35b2 (patch)
treeba7b429a961168a7a4e2c20d8284b4f2696c9cc6 /common.h
parentc941c00f7ea53acaa54c30d34c9efbf986072888 (diff)
downloadpack-master.tar.gz
pack-master.tar.xz
pack-master.zip
unpack.c: Cast negative signed offset to signedHEADmaster
As N1570ยง6.5.16.2p3 states, E1 += E2 is equivalent to E1 = E1 + (E2). This means that E1 + (E2) will be subject to (6.5.6p4) "the usual arithmetic conversions". Since both types have equal integer conversion rank (6.3.1.1p1), E1 which was intmax_t will first be converted to uintmax_t before being added to (E2). This is not the intended result as it relies on integer wrapping behaviour again. Casting E2 to intmax_t first prevents the conversion of E1 and produces the correct result.
Diffstat (limited to 'common.h')
0 files changed, 0 insertions, 0 deletions