From 26b286760c373082683e758358f36f2dfdafd629 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 13 Sep 2018 18:18:44 +0000 Subject: Test that FX_TryRealloc failure leaves original contents intact Change-Id: I2b1e5cc7a9576b5bb3bf3888225d1f6e54e0c95b Reviewed-on: https://pdfium-review.googlesource.com/42051 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fxcrt/fx_memory_unittest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/fxcrt/fx_memory_unittest.cpp b/core/fxcrt/fx_memory_unittest.cpp index 8036855898..8c577835d6 100644 --- a/core/fxcrt/fx_memory_unittest.cpp +++ b/core/fxcrt/fx_memory_unittest.cpp @@ -68,7 +68,9 @@ TEST(fxcrt, FX_TryAllocOverflow) { ptr = FX_Alloc(int, 1); EXPECT_TRUE(ptr); + *ptr = 1492; // Arbitrary sentinel. EXPECT_FALSE(FX_TryRealloc(int, ptr, kOverflowIntAlloc)); + EXPECT_EQ(1492, *ptr); FX_Free(ptr); } #endif -- cgit v1.2.3