我有以下代码,当LTO关闭时,地址清理程序仅捕获违规。在-Os和-O0之间进行更改并不会对其产生影响。有什么想法吗?
char *__attribute((noinline)) SCObfuscatedMalloc();
void SCCauseAddressSanitizerViolation() {
char *chars = SCObfuscatedMalloc();
if (rand() & 1) {
chars[2] = 3;
} else {
chars[2] = 2;
}
printf("yo: %zd\n", (NSInteger)chars[2]);
}
char *__attribute((noinline)) SCObfuscatedMalloc() {
return malloc(1);
}