From 70719a773df8e4ff1af6b8c8e9b6bf24e74ee500 Mon Sep 17 00:00:00 2001 From: deadbeef Date: Thu, 4 May 2017 12:16:28 -0700 Subject: [PATCH] Fixing pseudotcp_parser_fuzzer crash with NO_MAIN_THREAD_WRAPPING. The test was trying to solve this problem already with AutoThread, but the order of variable declaration was causing it to be created after "rtc::Thread::Current()" was already called. BUG=chromium:701262 TBR=pbos@webrtc.org Review-Url: https://codereview.webrtc.org/2858343002 Cr-Commit-Position: refs/heads/master@{#18019} --- webrtc/test/fuzzers/pseudotcp_parser_fuzzer.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webrtc/test/fuzzers/pseudotcp_parser_fuzzer.cc b/webrtc/test/fuzzers/pseudotcp_parser_fuzzer.cc index 4e14a13eeb..5e4165e5d2 100644 --- a/webrtc/test/fuzzers/pseudotcp_parser_fuzzer.cc +++ b/webrtc/test/fuzzers/pseudotcp_parser_fuzzer.cc @@ -31,19 +31,18 @@ class FakeIPseudoTcpNotify : public cricket::IPseudoTcpNotify { struct Environment { explicit Environment(cricket::IPseudoTcpNotify* notifier): - ptcp(new cricket::PseudoTcp(notifier, 0)) { + ptcp(notifier, 0) { } - cricket::PseudoTcp* const ptcp; - // We need the thread to avoid some uninteresting crashes, since the // production code expects there to be a thread object available. rtc::AutoThread thread; + cricket::PseudoTcp ptcp; }; Environment* env = new Environment(new FakeIPseudoTcpNotify()); void FuzzOneInput(const uint8_t* data, size_t size) { - env->ptcp->NotifyPacket(reinterpret_cast(data), size); + env->ptcp.NotifyPacket(reinterpret_cast(data), size); } } // namespace webrtc