Add a unit test for FX_Alloc().

Make sure it returns zeroed out memory.

Change-Id: Ie63f03373a2a281ce0719320132217b782f06f2e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/68151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_memory_unittest.cpp b/core/fxcrt/fx_memory_unittest.cpp
index b3fd299..395632b 100644
--- a/core/fxcrt/fx_memory_unittest.cpp
+++ b/core/fxcrt/fx_memory_unittest.cpp
@@ -94,6 +94,14 @@
   FXMEM_DefaultFree(ptr);
 }
 
+TEST(fxcrt, AllocZeroesMemory) {
+  uint8_t* ptr = FX_Alloc(uint8_t, 32);
+  ASSERT_TRUE(ptr);
+  for (size_t i = 0; i < 32; ++i)
+    EXPECT_EQ(0, ptr[i]);
+  FX_Free(ptr);
+}
+
 TEST(fxcrt, FXAlign) {
   static_assert(std::numeric_limits<size_t>::max() % 2 == 1,
                 "numeric limit must be odd for this test");