[PATCH] D28376: [compiler-rt] Add check to make sure that located PC is reasonable close.
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 13:22:05 PST 2017
vitalybuka updated this revision to Diff 83295.
vitalybuka added a comment.
Check for empty size
https://reviews.llvm.org/D28376
Files:
lib/asan/tests/asan_interface_test.cc
lib/sanitizer_common/sanitizer_stacktrace.cc
Index: lib/sanitizer_common/sanitizer_stacktrace.cc
===================================================================
--- lib/sanitizer_common/sanitizer_stacktrace.cc
+++ lib/sanitizer_common/sanitizer_stacktrace.cc
@@ -121,6 +121,8 @@
for (uptr i = 1; i < size; ++i) {
if (Distance(trace[i], pc) < Distance(trace[best], pc)) best = i;
}
+ if (size)
+ CHECK_LE(Distance(trace[best], pc), 10000);
return best;
}
Index: lib/asan/tests/asan_interface_test.cc
===================================================================
--- lib/asan/tests/asan_interface_test.cc
+++ lib/asan/tests/asan_interface_test.cc
@@ -10,9 +10,10 @@
// This file is a part of AddressSanitizer, an address sanity checker.
//
//===----------------------------------------------------------------------===//
-#include "asan_test_utils.h"
#include <sanitizer/allocator_interface.h>
#include <sanitizer/asan_interface.h>
+#include <sanitizer_common/sanitizer_internal_defs.h>
+#include "asan_test_utils.h"
TEST(AddressSanitizerInterface, GetEstimatedAllocatedSize) {
EXPECT_EQ(0U, __sanitizer_get_estimated_allocated_size(0));
@@ -399,7 +400,7 @@
TEST(AddressSanitizerInterface, SetErrorReportCallbackTest) {
__asan_set_error_report_callback(ErrorReportCallbackOneToZ);
- EXPECT_DEATH(__asan_report_error(0, 0, 0, 0, true, 1),
+ EXPECT_DEATH(__asan_report_error((void *)GET_CALLER_PC(), 0, 0, 0, true, 1),
ASAN_PCRE_DOTALL "ABCDEF.*AddressSanitizer.*WRITE.*ABCDEF");
__asan_set_error_report_callback(NULL);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28376.83295.patch
Type: text/x-patch
Size: 1543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/b69a4355/attachment.bin>
More information about the llvm-commits
mailing list