forked from OSchip/llvm-project
parent
823e85c37e
commit
dd8b3952b8
|
@ -124,10 +124,16 @@ SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_memcmp(const void *s1, const void *s2,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, uptr caller_pc,
|
||||||
|
const char *s1, const char *s2,
|
||||||
|
dfsan_label s1_label, dfsan_label s2_label)
|
||||||
|
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strcmp(const char *s1, const char *s2,
|
SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_strcmp(const char *s1, const char *s2,
|
||||||
dfsan_label s1_label,
|
dfsan_label s1_label,
|
||||||
dfsan_label s2_label,
|
dfsan_label s2_label,
|
||||||
dfsan_label *ret_label) {
|
dfsan_label *ret_label) {
|
||||||
|
CALL_WEAK_INTERCEPTOR_HOOK(dfsan_weak_hook_strcmp, GET_CALLER_PC(), s1, s2,
|
||||||
|
s1_label, s2_label);
|
||||||
for (size_t i = 0;; ++i) {
|
for (size_t i = 0;; ++i) {
|
||||||
if (s1[i] != s2[i] || s1[i] == 0 || s2[i] == 0) {
|
if (s1[i] != s2[i] || s1[i] == 0 || s2[i] == 0) {
|
||||||
if (flags().strict_data_dependencies) {
|
if (flags().strict_data_dependencies) {
|
||||||
|
|
|
@ -204,9 +204,14 @@ static inline int CharCmpX(unsigned char c1, unsigned char c2) {
|
||||||
return (c1 == c2) ? 0 : (c1 < c2) ? -1 : 1;
|
return (c1 == c2) ? 0 : (c1 < c2) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, uptr called_pc,
|
||||||
|
const char *s1, const char *s2)
|
||||||
|
|
||||||
INTERCEPTOR(int, strcmp, const char *s1, const char *s2) {
|
INTERCEPTOR(int, strcmp, const char *s1, const char *s2) {
|
||||||
void *ctx;
|
void *ctx;
|
||||||
COMMON_INTERCEPTOR_ENTER(ctx, strcmp, s1, s2);
|
COMMON_INTERCEPTOR_ENTER(ctx, strcmp, s1, s2);
|
||||||
|
CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, GET_CALLER_PC(), s1,
|
||||||
|
s2);
|
||||||
unsigned char c1, c2;
|
unsigned char c1, c2;
|
||||||
uptr i;
|
uptr i;
|
||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
|
|
Loading…
Reference in New Issue