ASAN on windows empty string literal false positive
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 12.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to reproduce this in a trivial project but haven't been able to yet.
ASAN (windows x64, llvm release 8.0.0) seems to be complaining about me accessing the null terminating byte of the empty string literal
in main.cpp:
int
main(int argc, char **argv)
{
{
db_strdup("", "file", 12);
}
...
in malloc.cpp:
char *
db_strdup(const char *str, const char *file, int line)
{
int len = strlen(str);
char *newStr = (char *)db_malloc(len + 1, file, line);
strcpy(newStr, str);
return newStr;
}
and asan is complaining on the strlen(str) call.
These excerpts from the error message seem to describe fine behavior:
READ of size 1 at 0x7ff710b1fe80 thread T0
0x7ff710b1fe80 is located 0 bytes inside of global variable '' defined in 'bdescribed.cpp:12:34' (0x7ff710b1fe80) of size 1
Is this an issue where the shadow bytes forgot to mark the null terminating byte as readable?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows x64 LLVM 8.0.0 report from the snippets in main.cpp and malloc.cpp, then inspect asan_issue.txt alongside the strlen call. Done means determining whether the empty string literal access is a false positive and identifying the relevant AddressSanitizer behavior or fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100