Skip to content
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

dcc asan fails to report uninit error when compiled with intermediary object file #75

Open
insou22 opened this issue Apr 21, 2022 · 1 comment

Comments

@insou22
Copy link
Member

insou22 commented Apr 21, 2022

$ dcc --version
dcc version 2.7.7
$ cat foo.c
#include <stdio.h>

int main(void) {
	int x;
	printf("%x\n", x);
}
$ dcc foo.c -c
foo.c:5:17: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
        printf("%x\n", x);
                       ^
foo.c:4:7: note: initialize the variable 'x' to silence this warning
        int x;
             ^
              = 0
1 warning generated.
$ ./foo
bebebebe

output without object file in the middle:

$ dcc foo.c -o foo
foo.c:5:17: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
        printf("%x\n", x);
                       ^
foo.c:4:7: note: initialize the variable 'x' to silence this warning
        int x;
             ^
              = 0
dcc explanation: It looks like you're trying to use the variable `x` on line 5 of `foo.c`.
 However, on that line, the variable `x` doesn't have a value yet.
 Be sure to assign a value to `x` before trying to access its value.

$ ./foo

Runtime error: uninitialized variable accessed.

Execution stopped in main() in foo.c at line 5:

int main(void) {
	int x;
-->	printf("%x\n", x);
}

Values when execution stopped:

x = <uninitialized value>
@insou22
Copy link
Member Author

insou22 commented Apr 21, 2022

well turns out this is not asan but dcc's own stack poisoning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant