diff options
| author | Bernie Innocenti <codewiz@google.com> | 2018-10-26 22:20:55 +0900 |
|---|---|---|
| committer | Bernie Innocenti <codewiz@google.com> | 2018-10-29 16:59:33 +0000 |
| commit | 3022c6e40d3ad28a45f783cf966bc8fb4450ba51 (patch) | |
| tree | 7c76cc38a82b1663fe004907eae691976a3c8b74 /server/XfrmControllerTest.cpp | |
| parent | 03d5eaf1162309a6b0b0e6fd94886f4d528a9a18 (diff) | |
Fix use-after-free asan hit in XfrmControllerTest
This test was forgetting to restore the original Syscalls object on
cleanup, causing an asan hit. The fix consists in switching to the safer
ScopedMockSyscalls, as all other tests do.
Test: atest netd_unit_test (with asan enabled)
Change-Id: I5ddaaf7e806aadd00b5b97006bf924ee5b7815dc
Diffstat (limited to 'server/XfrmControllerTest.cpp')
| -rw-r--r-- | server/XfrmControllerTest.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/server/XfrmControllerTest.cpp b/server/XfrmControllerTest.cpp index daa7b752..5b908604 100644 --- a/server/XfrmControllerTest.cpp +++ b/server/XfrmControllerTest.cpp @@ -129,10 +129,8 @@ void expectAddressEquals(int family, const std::string& expected, const xfrm_add } class XfrmControllerTest : public ::testing::Test { -public: - MockSyscalls mockSyscalls; - - void SetUp() override { netdutils::sSyscalls.swap(mockSyscalls); } + public: + testing::StrictMock<netdutils::ScopedMockSyscalls> mockSyscalls; }; // Test class allowing IPv4/IPv6 parameterized tests. |
