Actions
Bug #9010
closed
UK
UK
util: undefined behavior in fallback memrchr implementation
Bug #9010:
util: undefined behavior in fallback memrchr implementation
Affected Versions:
Effort:
Difficulty:
Label:
Description
The fallback memrchr() implementation in util-memrchr.c
initializes the search pointer to the one-past-end position
and dereferences it before decrementing.
Dereferencing a one-past-end pointer is undefined behavior in C.
This issue is to track the fix to decrement the pointer before
dereferencing it while preserving memrchr() semantics.
The accompanying unit tests also cover boundary cases and
high-byte values to pin the comparison semantics.
Actions