diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-09-13 18:18:44 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-13 18:18:44 +0000 |
commit | 26b286760c373082683e758358f36f2dfdafd629 (patch) | |
tree | be7bc0b3e7b2f5d28845e3acfc45893c4e6263ab | |
parent | 882ed81dec7afc5bc106f965af34f1e59407fd95 (diff) | |
download | pdfium-26b286760c373082683e758358f36f2dfdafd629.tar.xz |
Test that FX_TryRealloc failure leaves original contents intact
Change-Id: I2b1e5cc7a9576b5bb3bf3888225d1f6e54e0c95b
Reviewed-on: https://pdfium-review.googlesource.com/42051
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r-- | core/fxcrt/fx_memory_unittest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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 |