Backed out changeset 76404bf85ef7 for landing with the wrong bug number in the commit message.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 07 Jun 2017 22:43:58 -0400
changeset 411047 0d00b9dfaeb8de948db85d359a29bde8496a48d1
parent 411046 575e351a12af55a98990dd88c81bf20fbf983977
child 411048 4142967e1f23c25bebdc92ad1a486eb34a703588
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone55.0a1
backs out76404bf85ef79bacff8fd82b364698af17275d6b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 76404bf85ef7 for landing with the wrong bug number in the commit message.
image/decoders/nsPNGDecoder.cpp
media/libpng/pnglibconf.h
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -14,19 +14,17 @@
 #include "gfxPlatform.h"
 #include "imgFrame.h"
 #include "nsColor.h"
 #include "nsIInputStream.h"
 #include "nsMemory.h"
 #include "nsRect.h"
 #include "nspr.h"
 #include "png.h"
-
 #include "RasterImage.h"
-#include "SurfaceCache.h"
 #include "SurfacePipeFactory.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Telemetry.h"
 
 using namespace mozilla::gfx;
 
 using std::min;
 
@@ -566,23 +564,16 @@ nsPNGDecoder::info_callback(png_structp 
   // Always decode to 24-bit RGB or 32-bit RGBA
   png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
                &interlace_type, &compression_type, &filter_type);
 
   const IntRect frameRect(0, 0, width, height);
 
   // Post our size to the superclass
   decoder->PostSize(frameRect.width, frameRect.height);
-
-  if (width >
-    SurfaceCache::MaximumCapacity()/(bit_depth > 8 ? 16:8)) {
-    // libpng needs space to allocate two row buffers
-    png_error(decoder->mPNG, "Image is too wide");
-  }
-
   if (decoder->HasError()) {
     // Setting the size led to an error.
     png_error(decoder->mPNG, "Sizing error");
   }
 
   if (color_type == PNG_COLOR_TYPE_PALETTE) {
     png_set_expand(png_ptr);
   }
@@ -739,21 +730,16 @@ nsPNGDecoder::info_callback(png_structp 
     if (!decoder->mCMSLine) {
       png_error(decoder->mPNG, "malloc of mCMSLine failed");
     }
   }
 
   if (interlace_type == PNG_INTERLACE_ADAM7) {
     if (frameRect.height < INT32_MAX / (frameRect.width * int32_t(channels))) {
       const size_t bufferSize = channels * frameRect.width * frameRect.height;
-
-      if (bufferSize > SurfaceCache::MaximumCapacity()) {
-        png_error(decoder->mPNG, "Insufficient memory to deinterlace image");
-      }
-
       decoder->interlacebuf = static_cast<uint8_t*>(malloc(bufferSize));
     }
     if (!decoder->interlacebuf) {
       png_error(decoder->mPNG, "malloc of interlacebuf failed");
     }
   }
 }
 
--- a/media/libpng/pnglibconf.h
+++ b/media/libpng/pnglibconf.h
@@ -3,25 +3,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef PNGLCONF_H
 #define PNGLCONF_H
 
 #define MOZ_EMBEDDED_LIBPNG
 
 /* Limit image dimensions (bug #251381, #591822, #967656, and #1283961) */
-#define PNG_USER_LIMITS_SUPPORTED
 #ifndef MOZ_PNG_MAX_WIDTH
 #  define MOZ_PNG_MAX_WIDTH 0x7fffffffL /* Unlimited */
 #endif
 #ifndef MOZ_PNG_MAX_HEIGHT
 #  define MOZ_PNG_MAX_HEIGHT 0x7fffffffL /* Unlimited */
 #endif
-/* but allow nsPNGDecoder to override the limits (bug #1368407) */
-#define PNG_SET_USER_LIMITS_SUPPORTED
 
 #define PNG_API_RULE 0
 #define PNG_COST_SHIFT 3
 #define PNG_GAMMA_THRESHOLD_FIXED 5000
 #define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
 #define PNG_INFLATE_BUF_SIZE 1024
 #define PNG_LINKAGE_API extern
 #define PNG_LINKAGE_CALLBACK extern