mirror of
https://abf.rosa.ru/djam/firefox.git
synced 2025-02-25 02:52:59 +00:00
55 lines
2.1 KiB
Diff
55 lines
2.1 KiB
Diff
|
|
https://hg.mozilla.org/mozilla-central/rev/aff1bd412058
|
|
|
|
diff -Naurp mozilla-release/modules/libpr0n/decoders/nsICODecoder.cpp mozilla-release.oden/modules/libpr0n/decoders/nsICODecoder.cpp
|
|
--- mozilla-release/modules/libpr0n/decoders/nsICODecoder.cpp 2011-12-16 21:29:37.000000000 +0100
|
|
+++ mozilla-release.oden/modules/libpr0n/decoders/nsICODecoder.cpp 2011-12-21 11:14:51.059478943 +0100
|
|
@@ -385,8 +385,7 @@ nsICODecoder::WriteInternal(const char*
|
|
|
|
// Raymond Chen says that 32bpp only are valid PNG ICOs
|
|
// http://blogs.msdn.com/b/oldnewthing/archive/2010/10/22/10079192.aspx
|
|
- if (static_cast<nsPNGDecoder*>(mContainedDecoder.get())->HasValidInfo() &&
|
|
- static_cast<nsPNGDecoder*>(mContainedDecoder.get())->GetPixelDepth() != 32) {
|
|
+ if (!static_cast<nsPNGDecoder*>(mContainedDecoder.get())->IsValidICO()) {
|
|
PostDataError();
|
|
}
|
|
return;
|
|
diff -Naurp mozilla-release/modules/libpr0n/decoders/nsPNGDecoder.h mozilla-release.oden/modules/libpr0n/decoders/nsPNGDecoder.h
|
|
--- mozilla-release/modules/libpr0n/decoders/nsPNGDecoder.h 2011-12-16 21:29:37.000000000 +0100
|
|
+++ mozilla-release.oden/modules/libpr0n/decoders/nsPNGDecoder.h 2011-12-21 11:15:04.692567378 +0100
|
|
@@ -73,19 +73,25 @@ public:
|
|
|
|
void EndImageFrame();
|
|
|
|
- // Checks if the info header contains valid information
|
|
- bool HasValidInfo() const
|
|
+ // Check if PNG is valid ICO (32bpp RGBA)
|
|
+ // http://blogs.msdn.com/b/oldnewthing/archive/2010/10/22/10079192.aspx
|
|
+ bool IsValidICO() const
|
|
{
|
|
- return mInfo && mInfo->valid;
|
|
- }
|
|
+ png_uint_32
|
|
+ png_width, // Unused
|
|
+ png_height; // Unused
|
|
|
|
- // Obtain the pixel depth if available or 0 otherwise
|
|
- PRInt32 GetPixelDepth() const
|
|
- {
|
|
- if (!mInfo) {
|
|
- return 0;
|
|
+ int png_bit_depth,
|
|
+ png_color_type;
|
|
+
|
|
+ if (png_get_IHDR(mPNG, mInfo, &png_width, &png_height, &png_bit_depth,
|
|
+ &png_color_type, NULL, NULL, NULL)) {
|
|
+
|
|
+ return (png_color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
|
|
+ png_bit_depth == 8);
|
|
+ } else {
|
|
+ return false;
|
|
}
|
|
- return mInfo->pixel_depth;
|
|
}
|
|
|
|
public:
|