mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-25 22:30:49 +08:00
[MSan] "Fix" use-after-dtor in InitializationState.InitializationState
Since the test is specifically trying to exercise UB by testing the state of an object it is already destroyed, unpoison the memory to suppress MSan errors. Bug: 40222690 Change-Id: I840e944f5e8b39668ac05d8d641fdd5f2e3db5ac Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5716150 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
a1fc5d728b
commit
aef7de4e93
@ -18,6 +18,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/free_deleter.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@ -59,6 +60,10 @@ TEST(InitializationState, InitializationState) {
|
||||
// buffer that’s still valid and its destructor was called directly, this
|
||||
// approximates use-after-free without risking that the memory formerly used
|
||||
// for the InitializationState object has been repurposed.
|
||||
|
||||
// (Though this is still UB and MSan does not like this)
|
||||
MSAN_UNPOISON(initialization_state, sizeof(*initialization_state));
|
||||
|
||||
EXPECT_FALSE(initialization_state->is_uninitialized());
|
||||
EXPECT_FALSE(initialization_state->is_valid());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user