[all-commits] [llvm/llvm-project] 86f2e7: [Clang][Sema] Add -Wstringop-overread warning for ...
John Paul Jepko via All-commits
all-commits at lists.llvm.org
Mon Jun 22 10:30:34 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 86f2e71cb8d165b59ad31a442b2391e23826133e
https://github.com/llvm/llvm-project/commit/86f2e71cb8d165b59ad31a442b2391e23826133e
Author: John Paul Jepko <john.jepko at ericsson.com>
Date: 2026-06-22 (Mon, 22 Jun 2026)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaChecking.cpp
M clang/test/AST/ByteCode/builtin-functions.cpp
M clang/test/Analysis/bstring.c
M clang/test/Analysis/malloc.c
M clang/test/Analysis/pr22954.c
M clang/test/Sema/builtin-memcpy.c
M clang/test/Sema/builtin-object-size.c
M clang/test/Sema/warn-fortify-source.c
A clang/test/Sema/warn-stringop-overread.c
M compiler-rt/test/asan/TestCases/Windows/issue64990.cpp
Log Message:
-----------
[Clang][Sema] Add -Wstringop-overread warning for source buffer overreads (#183004)
This PR adds a new `-Wstringop-overread` warning that diagnoses calls to
memory functions where the specified size exceeds the size of the source
buffer, increasing parity with GCC's `-Wstringop-overread`.
The warning is emitted when the read size is a compile-time constant
that is greater than the size of the source buffer (when known
statically).
This check applies to the following functions:
- `memcpy`, `memmove`, `mempcpy` (and `__builtin_` / `__builtin___*_chk`
variants)
- `memchr`
- `memcmp`, `bcmp`
Some of the existing code for `-Wfortify-source` was refactored into a
helper class to make its lambdas accessible to other functions.
Fixes #83728
Assisted-by: claude-opus-4.6
---------
Co-authored-by: Erich Keane <ekeane at nvidia.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list