-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
Labels
compiler-rt:asanAddress sanitizerAddress sanitizer
Description
It looks like there's no ASAN interceptor for mempcpy
.
Typically, by default clang will treat mempcpy
as a built-in function, and replace it by memcpy
, which would then be replaced by __asan_memcpy
.
However, if the user specifies a flag like -std=c++20
, mempcpy
will no longer be treated as a built-in and will not get any kind of asan instrumentation.
The following C++ program crashes when compiled with -O0 -fsanitize=address
but fails when compiled with -O0 -fsanitize=address -std=c++20
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char buffer[1024] = {0};
int main(void) {
void* data = malloc(1020);
mempcpy(data, buffer, 1024);
free(data);
return 0;
}
Metadata
Metadata
Assignees
Labels
compiler-rt:asanAddress sanitizerAddress sanitizer