[tor-commits] [tor-browser] 58/76: Bug 1758975 - Ensure GIF color tables are opaque by default. r=tnikkel a=RyanVM

gitolite role git at cupani.torproject.org
Wed Mar 30 20:40:26 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit eac6580f5edd8a156e49f7882b85c4bef9cf88ec
Author: Andrew Osmond <aosmond at mozilla.com>
AuthorDate: Fri Mar 18 15:22:46 2022 +0000

    Bug 1758975 - Ensure GIF color tables are opaque by default. r=tnikkel a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D141176
---
 image/decoders/nsGIFDecoder2.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/image/decoders/nsGIFDecoder2.cpp b/image/decoders/nsGIFDecoder2.cpp
index c75cc397327b0..c273105a7df86 100644
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -91,8 +91,10 @@ nsGIFDecoder2::nsGIFDecoder2(RasterImage* aImage)
       mGIFOpen(false),
       mSawTransparency(false),
       mSwizzleFn(nullptr) {
-  // Clear out the structure, excluding the arrays.
+  // Clear out the structure, excluding the arrays. Ensure that the global
+  // colormap is initialized as opaque.
   memset(&mGIFStruct, 0, sizeof(mGIFStruct));
+  memset(mGIFStruct.global_colormap, 0xFF, sizeof(mGIFStruct.global_colormap));
 
   // Each color table will need to be unpacked.
   mSwizzleFn = SwizzleRow(SurfaceFormat::R8G8B8, SurfaceFormat::OS_RGBA);
@@ -854,6 +856,8 @@ LexerTransition<nsGIFDecoder2::State> nsGIFDecoder2::FinishImageDescriptor(
         mGIFStruct.local_colormap_buffer_size = mColormapSize;
         mGIFStruct.local_colormap =
             static_cast<uint32_t*>(moz_xmalloc(mColormapSize));
+        // Ensure the local colormap is initialized as opaque.
+        memset(mGIFStruct.local_colormap, 0xFF, mColormapSize);
       } else {
         mColormapSize = mGIFStruct.local_colormap_buffer_size;
       }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list