aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_darwin_init.c
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2024-03-18 17:14:30 +0400
committerSergey Kandaurov <pluknet@nginx.com>2024-03-18 17:14:30 +0400
commit3d5a356abb4f06b0f103290bd31a4c146233956b (patch)
treeb380dca90f465f05a35f7483beeeacb5496cb54e /src/os/unix/ngx_darwin_init.c
parentd3d64cacb3ce96477d354fe17d3b5c6e348f933a (diff)
downloadnginx-3d5a356abb4f06b0f103290bd31a4c146233956b.tar.gz
nginx-3d5a356abb4f06b0f103290bd31a4c146233956b.zip
Fixed undefined behaviour with IPv4-mapped IPv6 addresses.
Previously, it could result when left-shifting signed integer due to implicit integer promotion, such that the most significant bit appeared on the sign bit. In practice, though, this results in the same left value as with an explicit cast, at least on known compilers, such as GCC and Clang. The reason is that in_addr_t, which is equivalent to uint32_t and same as "unsigned int" in ILP32 and LP64 data type models, has the same type width as the intermediate after integer promotion, so there's no side effects such as sign-extension. This explains why adding an explicit cast does not change object files in practice. Found with UndefinedBehaviorSanitizer (shift). Based on a patch by Piotr Sikora.
Diffstat (limited to 'src/os/unix/ngx_darwin_init.c')
0 files changed, 0 insertions, 0 deletions