diff --git a/compiler-rt/lib/asan/asan_poisoning.cpp b/compiler-rt/lib/asan/asan_poisoning.cpp index 10f5e97f8a5aee..c84c3e2a952677 100644 --- a/compiler-rt/lib/asan/asan_poisoning.cpp +++ b/compiler-rt/lib/asan/asan_poisoning.cpp @@ -606,6 +606,9 @@ void __sanitizer_move_contiguous_container_annotations( &stack); } + if(old_storage_beg == old_storage_end) + return; + uptr new_internal_beg = RoundUpTo(new_storage_beg, granularity); uptr old_internal_beg = RoundUpTo(old_storage_beg, granularity); uptr new_external_beg = RoundDownTo(new_storage_beg, granularity); diff --git a/compiler-rt/test/asan/TestCases/move_container_annotations.cpp b/compiler-rt/test/asan/TestCases/move_container_annotations.cpp index f21826ca0b7939..7be6eca7f8625a 100644 --- a/compiler-rt/test/asan/TestCases/move_container_annotations.cpp +++ b/compiler-rt/test/asan/TestCases/move_container_annotations.cpp @@ -81,7 +81,7 @@ void TestMove(size_t capacity, size_t off_old, size_t off_new, for (int i = 0; i < 1000; i++) { RandomPoison(old_beg, old_end); - std::deque poison_states(old_beg, old_end); + std::deque poison_states = GetPoisonedState(gold_beg, old_end); __sanitizer_move_contiguous_container_annotations(old_beg, old_end, new_beg, new_end); @@ -93,7 +93,7 @@ void TestMove(size_t capacity, size_t off_old, size_t off_new, for (; cur < old_end; ++cur) { assert(!__asan_address_is_poisoned(cur)); } - // Memory after old_beg should be the same as at the beginning. + // Memory after old_end should be the same as at the beginning. for (; cur < old_buffer_end; ++cur) { assert(__asan_address_is_poisoned(cur) == poison_old); }