From 3daf711085889bad1bd68651bc4e8790412ae105 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 26 Apr 2022 10:13:11 -0500 Subject: =?UTF-8?q?Issue=20#1829=20-=20Revert=20=E2=80=9CIssue=20#1751=20-?= =?UTF-8?q?-=20Remove=20XP=5FMACOSX=20conditionals=20from=20the=20rest=20o?= =?UTF-8?q?f=20the=20tree.=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also removes some PP abuse and takes file entries out of PP when no longer needed without XP_MACOSX conditionals. This reverts commit 6f707bde95dab6998ac204f9ee6c925ee230c740. --- image/imgFrame.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'image/imgFrame.cpp') diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp index e2be7673b4..9a0846bce2 100644 --- a/image/imgFrame.cpp +++ b/image/imgFrame.cpp @@ -123,12 +123,20 @@ AllowedImageSize(int32_t aWidth, int32_t aHeight) return false; } - // check to make sure we don't overflow 32-bit size for RGBA + // check to make sure we don't overflow a 32-bit CheckedInt32 requiredBytes = CheckedInt32(aWidth) * CheckedInt32(aHeight) * 4; if (MOZ_UNLIKELY(!requiredBytes.isValid())) { NS_WARNING("width or height too large"); return false; } +#if defined(XP_MACOSX) + // CoreGraphics is limited to images < 32K in *height*, so clamp all surfaces + // on the Mac to that height + if (MOZ_UNLIKELY(aHeight > SHRT_MAX)) { + NS_WARNING("image too big"); + return false; + } +#endif return true; } -- cgit v1.2.3