Blame SOURCES/gtest-1.8.0-null-pointer.patch

09583b
From 62466cfccad1a4fe3f59a2c33104c40adc01b4fe Mon Sep 17 00:00:00 2001
09583b
From: Jonathan Wakely <jwakely@redhat.com>
09583b
Date: Fri, 23 Dec 2016 01:56:14 +0000
09583b
Subject: [PATCH] Stop TestInfo::Run() calling a function through null pointer
09583b
09583b
If the object was never created then trying to call &Test::DeleteSelf_
09583b
will dereference a null pointer, with undefined behaviour.
09583b
09583b
Fixes #845
09583b
---
09583b
 googletest/src/gtest.cc | 10 ++++++----
09583b
 1 file changed, 6 insertions(+), 4 deletions(-)
09583b
09583b
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
09583b
index d882ab2..1fb05ea 100644
09583b
--- a/googletest/src/gtest.cc
09583b
+++ b/googletest/src/gtest.cc
09583b
@@ -2656,10 +2656,12 @@ void TestInfo::Run() {
09583b
     test->Run();
09583b
   }
09583b
 
09583b
-  // Deletes the test object.
09583b
-  impl->os_stack_trace_getter()->UponLeavingGTest();
09583b
-  internal::HandleExceptionsInMethodIfSupported(
09583b
-      test, &Test::DeleteSelf_, "the test fixture's destructor");
09583b
+  if (test != NULL) {
09583b
+    // Deletes the test object.
09583b
+    impl->os_stack_trace_getter()->UponLeavingGTest();
09583b
+    internal::HandleExceptionsInMethodIfSupported(
09583b
+        test, &Test::DeleteSelf_, "the test fixture's destructor");
09583b
+  }
09583b
 
09583b
   result_.set_elapsed_time(internal::GetTimeInMillis() - start);
09583b