Project

General

Profile

Actions

Bug #9010

closed
UK UK

util: undefined behavior in fallback memrchr implementation

Bug #9010: util: undefined behavior in fallback memrchr implementation

Added by Urval Kheni 9 days ago. Updated 5 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
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.


Subtasks 1 (0 open1 closed)

Bug #9014: util: undefined behavior in fallback memrchr implementation (8.0.x backport)ClosedPhilippe AntoineActions
Actions

Also available in: PDF Atom