diff options
author | Ziqing Luo <ziqing@udel.edu> | 2025-07-30 12:57:04 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-30 11:57:04 +0800 |
commit | e10b182a5fb020f6b69ea95d00fd8590bba7559b (patch) | |
tree | 946ab883164838b94398dc44e70a06bcfc06661f /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | b663e563cce2bcf6cf7e15799f0ab1cfc56a8361 (diff) | |
download | llvm-e10b182a5fb020f6b69ea95d00fd8590bba7559b.zip llvm-e10b182a5fb020f6b69ea95d00fd8590bba7559b.tar.gz llvm-e10b182a5fb020f6b69ea95d00fd8590bba7559b.tar.bz2 |
[-Wunsafe-buffer-usage] Support safe patterns of "%.*s" in printf functions (#145862)
The character buffer passed to a "%.*s" specifier may be safely bound if
the precision is properly specified, even if the buffer does not
guarantee null-termination.
For example,
```
void f(std::span<char> span) {
printf("%.*s", (int)span.size(), span.data()); // "span.data()" does not guarantee null-termination but is safely bound by "span.size()", so this call is safe
}
```
rdar://154072130
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions