-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ASan misses use after free #652
Comments
Works for me on current trunk on x86_64-unknown-linux-gnu:
|
How can I try to reproduce it with trunk? Would it be enough to build latest Clang? |
You'll need to build trunk LLVM, Clang and Compiler-rt. Please refer this page for more detailed instructions: |
My theory is that Mac libc++ is configured to use the "small string optimization", so the memory for the std::string is stored on the stack. ASan's use after scope functionality is not working currently, so ASan cannot detect this bug on Mac. You can try to validate the theory by retrying the test with std::vector and see if ASan finds the bug. |
In case of small string optimization we won't find a heap-use-after-free because there will be no such bug. Instead we'll have stack-use-after-scope which asan currently can not detect, see #83 |
ASan can't catch use after free in the following case:
Compilation command:
I'm using Mac OS 10.10.5, Clang version info:
otool -vtV
output on produced binary:The text was updated successfully, but these errors were encountered: