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

VJ Updated by Victor Julien 8 days ago Actions #1

  • Status changed from New to Resolved
  • Assignee set to Urval Kheni
  • Target version changed from TBD to 9.0.0-beta1
  • Label Needs backport to 8.0 added

OT Updated by OISF Ticketbot 8 days ago Actions #2

  • Subtask #9014 added

OT Updated by OISF Ticketbot 8 days ago Actions #3

  • Label deleted (Needs backport to 8.0)

VJ Updated by Victor Julien 5 days ago Actions #4

  • Status changed from Resolved to Closed

SB Updated by Shivani Bhardwaj 5 days ago Actions #5

  • Subject changed from Fix undefined behavior in fallback memrchr implementation to util: undefined behavior in fallback memrchr implementation
Actions

Also available in: PDF Atom