[clang] [clang][analyzer] Support strlen with offset to string literal in CStringChecker (PR #159795)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 22 08:22:04 PDT 2025
================
@@ -235,6 +242,19 @@ void testStrlenCallee(void) {
clang_analyzer_eval(lenBefore == lenAfter); // expected-warning{{UNKNOWN}}
}
+void strlen_symbolic_offset(unsigned x) {
+ const char *str = "abcd";
+ if (x > 3)
+ return;
+ // FIXME: these should be known
----------------
balazske wrote:
The test was about the limits of the range for `strlen(str + x)` (but somehow conditions were wrong). Still this range is not recognized by the analyzer (probably because there is a subtraction).
https://github.com/llvm/llvm-project/pull/159795
More information about the cfe-commits
mailing list