Statically assert PixelWeight is trivially destructible
Due to C-style variable-sizing tricks, these will never be
destroyed by C++.
Change-Id: Iaf43d163b24a5d7ad35e6aba791015df678189f4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81986
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/dib/fx_dib.cpp b/core/fxge/dib/fx_dib.cpp
index 2d50e83..315388b 100644
--- a/core/fxge/dib/fx_dib.cpp
+++ b/core/fxge/dib/fx_dib.cpp
@@ -7,12 +7,17 @@
#include "core/fxge/dib/fx_dib.h"
#include <tuple>
+#include <type_traits>
#include <utility>
#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
+static_assert(
+ std::is_trivially_destructible<PixelWeight>::value,
+ "PixelWeight storage may be re-used without invoking its destructor");
+
#if defined(OS_WIN)
static_assert(sizeof(FX_COLORREF) == sizeof(COLORREF),
"FX_COLORREF vs. COLORREF mismatch");