forked from OSchip/llvm-project
sanitizer_common: fix up onprint.cpp test more
D112630 ("sanitizer_common: fix up onprint.cpp test") added O_CREAT, but we also need O_TRUNC b/c the file may not exist, or may exist as well. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D112788
This commit is contained in:
parent
b42d51ba9a
commit
a871c34e8d
|
@ -26,7 +26,7 @@ __sanitizer_on_print(const char *str) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
assert(argc >= 2);
|
||||
f = open(argv[1], O_CREAT | O_WRONLY, 0666);
|
||||
f = open(argv[1], O_CREAT | O_TRUNC | O_WRONLY, 0666);
|
||||
|
||||
// Use-after-free to trigger ASan/TSan reports.
|
||||
void *ptr = malloc(1);
|
||||
|
|
Loading…
Reference in New Issue