Tighten kMaxTableBytesAllowed

This is an arbitrary limit to prevent OOM, so there isn't any
reason to subtract kBytesPerWeight from it. It also is kinda
large at a 1GB - x, so round down to 512 MB rather than up to 1GB.

Change-Id: Ibfa3cb5ebca8739e5fd664c2ac371435c01eb619
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81750
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index 222dd29..3fe7f3e 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -40,8 +40,8 @@
                                         int src_min,
                                         int src_max,
                                         const FXDIB_ResampleOptions& options) {
-  static constexpr size_t kBytesPerWeight = sizeof(PixelWeight::m_Weights[0]);
-  static constexpr size_t kMaxTableBytesAllowed = (1 << 30) - kBytesPerWeight;
+  // 512MB should be large enough for this while preventing OOM.
+  static constexpr size_t kMaxTableBytesAllowed = 512 * 1024 * 1024;
 
   // Help the compiler realize that these can't change during a loop iteration:
   const bool bilinear = options.bInterpolateBilinear;