summaryrefslogtreecommitdiffhomepage
path: root/src/stream/ngx_stream_geo_module.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-03-18Fixed undefined behaviour with IPv4-mapped IPv6 addresses.Sergey Kandaurov1-2/+2
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-14Geo: fixed uninitialized memory access.Piotr Sikora1-3/+1
While copying ngx_http_variable_value_t structures to geo binary base in ngx_http_geo_copy_values(), and similarly in the stream module, uninitialized parts of these structures are copied as well. These include the "escape" field and possible holes. Calculating crc32 of this data triggers uninitialized memory access. Found with MemorySanitizer. Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
2018-12-14Geo: fixed handling of AF_UNIX client addresses (ticket #1684).Maxim Dounin1-0/+13
Previously, AF_UNIX client addresses were handled as AF_INET, leading to unexpected results.
2018-02-21Geo: fixed indentation.Sergey Kandaurov1-11/+11
2018-02-21Geo: optimized configuration parser.Ruslan Ermilov1-1/+5
If the geo block parser has failed, doing more things is pointless.
2018-02-21Geo: fixed memory allocation error handling (closes #1482).Ruslan Ermilov1-11/+16
If during configuration parsing of the geo directive the memory allocation has failed, pool used to parse configuration inside the block, and sometimes the temporary pool were not destroyed.
2017-08-09Fixed calls to ngx_open_file() in certain places.Sergey Kandaurov1-1/+1
Pass NGX_FILE_OPEN to ngx_open_file() to fix "The parameter is incorrect" error on win32 when using the ssl_session_ticket_key directive or loading a binary geo base. On UNIX, this change is a no-op.
2017-08-09Style.Sergey Kandaurov1-0/+1
2016-08-23Geo: fixed warnings when removing nonexistent ranges.Ruslan Ermilov1-7/+3
geo $geo { ranges; 10.0.0.0-10.0.0.255 test; delete 10.0.1.0-10.0.1.255; # should warn delete 10.0.0.0-10.0.0.255; delete 10.0.0.0-10.0.0.255; # should warn }
2016-08-23Geo: fixed insertion of ranges specified in descending order.Ruslan Ermilov1-3/+8
2016-08-23Geo: fixed removing a range in certain cases.Ruslan Ermilov1-1/+1
If the range includes two or more /16 networks and does not start at the /16 boundary, the last subrange was not removed (see 91cff7f97a50 for details).
2016-08-23Geo: fixed overflow when iterating over ranges.Ruslan Ermilov1-2/+10
2016-08-18Geo: fixed access to already freed memory.Valentin Bartenev1-1/+6
Previously, in "ranges" mode when all added ranges were deleted, the ctx.high.low[i] was left pointing to a temporary array.
2016-06-30Stream: geo module.Vladimir Homutov1-0/+1572