Files
clang-p2996/compiler-rt/test/asan/TestCases/frexpf_interceptor.cpp
Emily Shi cfa4d112da [compiler-rt] change write order of frexpl & frexpf so it doesn't corrupt stack ids
This was fixed in the past for `frexp`, but was not made for `frexpl` & `frexpf` https://github.com/google/sanitizers/issues/321
This patch copies the fix over to `frexpl` because it caused `frexp_interceptor.cpp` test to fail on iPhone and `frexpf` for consistency.

rdar://79652161

Reviewed By: delcypher, vitalybuka

Differential Revision: https://reviews.llvm.org/D104948
2021-07-16 10:58:12 -07:00

17 lines
338 B
C++

// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
// Test the frexpf() interceptor.
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
float x = 3.14;
int *exp = (int *)malloc(sizeof(int));
free(exp);
double y = frexpf(x, exp);
// CHECK: use-after-free
// CHECK: SUMMARY
return 0;
}