-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang static analyzer] False negatives related to symbol values #108520
Comments
@llvm/issue-subscribers-clang-static-analyzer Author: Tianxing He (tianxinghe)
commit 3e47883 (HEAD -> main, origin/main, origin/HEAD)
Author: Giulio Eulisse <10544+ktf@users.noreply.github.com>
Date: Thu Sep 5 10:16:51 2024 +0200
For this 200-line test case, the static analyzer failed to detect the null pointer dereference bug.
|
Here is a reduced example ( #include <stdint.h>
uint64_t *args;
char func0_v10, func0_v15;
void func0();
void top() {
uint64_t *v1;
uint64_t *inptr;
uint64_t input0;
uint64_t *inptr1;
uint64_t input1;
uint64_t *inptr2;
uint64_t input2;
uint8_t v4;
uint8_t v5;
uint8_t *v7 = 0;
char v32, v37;
v1 = args;
inptr = v1;
input0 = *inptr;
inptr1 = &v1[1];
input1 = *inptr1;
inptr2 = &v1[2];
input2 = *inptr2;
v37 = (input2) >= (49);
1049 > input1;
input0 < 2067997187;
func0();
v32 = input1 == input2;
if (v32)
goto block1;
goto block2;
block4:
func0(&v7, &v5);
block3:
goto block4;
block1:
707955933 == input1;
goto block3;
block2:
v7 = &v4;
goto block1;
}
void func0(uint8_t **a1, uint8_t **a2) {
uint8_t v2;
uint8_t *bugptr;
goto block1;
block5:
bugptr = *a1;
*bugptr;
goto exit;
block4:
if (func0_v10)
;
goto block5;
block6:
block2:
goto block4;
block1:
*a2 = &v2;
if (func0_v15)
goto block2;
goto block3;
exit:
block3:
} |
commit 3e47883 (HEAD -> main, origin/main, origin/HEAD)
Author: Giulio Eulisse 10544+ktf@users.noreply.github.com
Date: Thu Sep 5 10:16:51 2024 +0200
clang --analyze --analyzer-no-default-checks -Xanalyzer -analyzer-checker=core.NullDereference -Xanalyzer -analyzer-config -Xanalyzer -mode=deep -Xanalyzer -analyzer-output=text
For this 200-line test case, the static analyzer failed to detect the null pointer dereference bug.
It is important to note that removing any one of the following pieces of dead code allows the analyzer to work correctly.
v37 = (input2) >= (49);
v38 = (166841049) > (input1);
v10 = (input0) < (2067997187);
v11 = (input1) <= (618503425);
The text was updated successfully, but these errors were encountered: