Commit c3bbfd45 authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Fix crashes in pipeline_integration_fuzzertest on GoogleTest assertion failure.

These tests use GoogleTest assertions without using GoogleTest's testing
framework. Since UnitTest::Run() and friends (via RUN_ALL_TESTS) aren't
used to run the tests, Google Test's stack trace getter's
UponLeavingGTest method isn't called prior to running the actual test
code. Upon assertion failure, there is no basis on which to trim the
failure's stack trace.

This CL adds a single call to UponLeavingGTest in LLVMFuzzerTestOneInput
to provide such a basis. Better alternatives are to either run the tests
via RUN_ALL_TESTS (after calling testing::InitGoogleTest) or not use
GoogleTest assertions out of context.

BUG=1039559

Change-Id: I3aa5fa5a36361450548403babddb337af41d25d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089845Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747882}
parent 6176b1d2
...@@ -175,6 +175,10 @@ foreach(variant, pipeline_integration_fuzzer_variants) { ...@@ -175,6 +175,10 @@ foreach(variant, pipeline_integration_fuzzer_variants) {
# header for pipeline_integration_test_base.h. This should be # header for pipeline_integration_test_base.h. This should be
# moved into the .cc file to avoid the extra dependency here. # moved into the .cc file to avoid the extra dependency here.
"//testing/gmock", "//testing/gmock",
# TODO(https://crbug.com/1039559): Required for inclusion of
# gtest-internal-inl.h.
"//testing/gtest",
"//ui/gfx:test_support", "//ui/gfx:test_support",
] ]
......
...@@ -3,3 +3,9 @@ include_rules = [ ...@@ -3,3 +3,9 @@ include_rules = [
"+mojo/public", "+mojo/public",
"+services/service_manager/public/cpp", "+services/service_manager/public/cpp",
] ]
specific_include_rules = {
"pipeline_integration_fuzzertest\.cc": [
"+third_party/googletest/src/googletest/src/gtest-internal-inl.h",
],
}
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
#include "media/test/pipeline_integration_test_base.h" #include "media/test/pipeline_integration_test_base.h"
#include "media/test/test_media_source.h" #include "media/test/test_media_source.h"
#include "third_party/googletest/src/googletest/src/gtest-internal-inl.h"
namespace { namespace {
...@@ -247,6 +248,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -247,6 +248,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
FuzzerVariant variant = PIPELINE_FUZZER_VARIANT; FuzzerVariant variant = PIPELINE_FUZZER_VARIANT;
// These tests use GoogleTest assertions without using the GoogleTest
// framework. While this is the case, tell GoogleTest's stack trace getter
// that GoogleTest is being left now so that there is a basis for traces
// collected upon assertion failure. TODO(https://crbug.com/1039559): use
// RUN_ALL_TESTS() and remove this code.
::testing::internal::GetUnitTestImpl()
->os_stack_trace_getter()
->UponLeavingGTest();
if (variant == SRC) { if (variant == SRC) {
media::ProgressivePipelineIntegrationFuzzerTest test; media::ProgressivePipelineIntegrationFuzzerTest test;
test.RunTest(data, size); test.RunTest(data, size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment