The official NGINX Open Source repository.
Go to file
Sergey Kandaurov 3d5a356abb 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.
2024-03-18 17:14:30 +04:00
auto Stream: ngx_stream_pass_module. 2024-02-21 17:36:02 +04:00
conf MIME: added image/avif type. 2021-10-25 20:49:15 +03:00
contrib Contrib: vim syntax, update core and 3rd party module directives. 2023-07-24 18:04:41 +03:00
docs nginx-1.25.4-RELEASE 2024-02-14 15:55:46 +04:00
misc Updated OpenSSL and zlib used for win32 builds. 2024-02-14 15:55:42 +04:00
src Fixed undefined behaviour with IPv4-mapped IPv6 addresses. 2024-03-18 17:14:30 +04:00
.hgtags release-1.25.4 tag 2024-02-14 20:03:00 +04:00