History log of /freebsd/lib/libc/amd64/string/memchr.S (Results 1 – 2 of 2)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/14.0.0
# b2618b65 10-Sep-2023 Robert Clausecker <fuz@FreeBSD.org>

lib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers

When memchr(buf, c, len) is called with a phony len (say, SIZE_MAX),
buf + len overflows and we have buf + len < buf. This con

lib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers

When memchr(buf, c, len) is called with a phony len (say, SIZE_MAX),
buf + len overflows and we have buf + len < buf. This confuses the
implementation and makes it return incorrect results. Neverthless we
must support this case as memchr() is guaranteed to work even with
phony buffer lengths, as long as a match is found before the buffer
actually ends.

Sponsored by: The FreeBSD Foundation
Reported by: yuri, des
Tested by: des
Approved by: mjg (blanket, via IRC)
MFC after: 1 week
MFC to: stable/14
PR: 273652

show more ...


# de12a689 24-Aug-2023 Robert Clausecker <fuz@FreeBSD.org>

lib/libc/amd64/string: add memchr(3) scalar, baseline implementation

This is conceptually similar to strchr(3), but there are
slight changes to account for the buffer having an explicit
buffer lengt

lib/libc/amd64/string: add memchr(3) scalar, baseline implementation

This is conceptually similar to strchr(3), but there are
slight changes to account for the buffer having an explicit
buffer length.

Sponsored by: The FreeBSD Foundation
Approved by: mjg
MFC after: 1 week
MFC to: stable/14
Differential Revision: https://reviews.freebsd.org/D41598

show more ...