[clang] [clang][Sema] Add buffer-size checks for unistd I/O functions (PR #224979)
Venkatesh Srinivasan via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 11:01:15 PDT 2026
venk-ks wrote:
Quick heads-up: #204337 (`fread`/`fwrite`/`fgets`) just landed on `main` and touched `checkFortifiedBuiltinMemoryFunction` in two ways that affect this PR on rebase:
1. `SourceSize` and `DestinationSize` in `checkFortifiedBuiltinMemoryFunction` were renamed to `AccessSize` and `BufferSize`.
2. It added `diag::warn_fortify_source_overread` (`InGroup<FortifySource>`, used by `fwrite`). Instead of calling `Checker.checkSourceOverread(1, 2)` (which emits `-Wstringop-overread`), `write`, `pwrite`, and `pwrite64` can now set:
```cpp
DiagID = diag::warn_fortify_source_overread;
AccessSize = Checker.ComputeExplicitObjectSizeArgument(2);
BufferSize = Checker.ComputeSizeArgument(1);
break;
```
so that their overread warnings are emitted under `-Wfortify-source` as well (along with updating the `write`/`pwrite`/`pwrite64` warning expectations in the tests and `ReleaseNotes.md`).
https://github.com/llvm/llvm-project/pull/224979
More information about the cfe-commits
mailing list