[clang] [analyzer] Fix crash in CStringChecker on zero-size element types (PR #191061)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 15:46:26 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 53526 tests passed
* 1081 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.Analysis/bstring.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -analyze -setup-static-analyzer -verify C:\_work\llvm-project\llvm-project\clang\test\Analysis\bstring.c    -analyzer-checker=core    -analyzer-checker=unix.cstring    -analyzer-checker=alpha.unix.cstring    -analyzer-disable-checker=alpha.unix.cstring.UninitializedRead    -analyzer-checker=debug.ExprInspection    -analyzer-config eagerly-assume=false
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -analyze -setup-static-analyzer -verify 'C:\_work\llvm-project\llvm-project\clang\test\Analysis\bstring.c' -analyzer-checker=core -analyzer-checker=unix.cstring -analyzer-checker=alpha.unix.cstring -analyzer-disable-checker=alpha.unix.cstring.UninitializedRead -analyzer-checker=debug.ExprInspection -analyzer-config eagerly-assume=false
# .---command stderr------------
# | error: 'expected-warning' diagnostics expected but not seen: 
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\bstring.c Line 537 (directive at C:\_work\llvm-project\llvm-project\clang\test\Analysis\bstring.c:538): 'memcpy' will always overflow; destination buffer has size 0, but size argument is 2
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\bstring.c Line 537 (directive at C:\_work\llvm-project\llvm-project\clang\test\Analysis\bstring.c:539): Memory copy function overflows the destination buffer
# | 2 errors generated.
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/191061


More information about the cfe-commits mailing list