Title: [122269] trunk/Source/WebCore
Revision
122269
Author
[email protected]
Date
2012-07-10 15:11:54 -0700 (Tue, 10 Jul 2012)

Log Message

Fix a potential bug of BitmapImage::frameCount().
https://bugs.webkit.org/show_bug.cgi?id=90756

Patch by Huang Dongsung <[email protected]> on 2012-07-10
Reviewed by Simon Fraser.

If an ImageDecoder is not yet initialized, m_source.frameCount() returns 0. This
does not mean that the frame count is actually 0. So we must set
m_haveFrameCount to true only when m_frameCount is not 0.

The current code is okay because BitmapImage::frameCount() is never called
before the decoder is initialized. However, this no longer holds true once we
introduce parallel image decoders.

No new tests, no behavior change.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::frameCount):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122268 => 122269)


--- trunk/Source/WebCore/ChangeLog	2012-07-10 22:08:14 UTC (rev 122268)
+++ trunk/Source/WebCore/ChangeLog	2012-07-10 22:11:54 UTC (rev 122269)
@@ -1,3 +1,23 @@
+2012-07-10  Huang Dongsung  <[email protected]>
+
+        Fix a potential bug of BitmapImage::frameCount().
+        https://bugs.webkit.org/show_bug.cgi?id=90756
+
+        Reviewed by Simon Fraser.
+
+        If an ImageDecoder is not yet initialized, m_source.frameCount() returns 0. This
+        does not mean that the frame count is actually 0. So we must set
+        m_haveFrameCount to true only when m_frameCount is not 0.
+
+        The current code is okay because BitmapImage::frameCount() is never called
+        before the decoder is initialized. However, this no longer holds true once we
+        introduce parallel image decoders.
+
+        No new tests, no behavior change.
+
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::frameCount):
+
 2012-07-10  Ojan Vafai  <[email protected]>
 
         Build fix. Removing unused variable from http://trac.webkit.org/changeset/122264.

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (122268 => 122269)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-07-10 22:08:14 UTC (rev 122268)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-07-10 22:11:54 UTC (rev 122269)
@@ -263,9 +263,12 @@
 size_t BitmapImage::frameCount()
 {
     if (!m_haveFrameCount) {
-        m_haveFrameCount = true;
         m_frameCount = m_source.frameCount();
-        didDecodeProperties();
+        // If decoder is not initialized yet, m_source.frameCount() returns 0.
+        if (m_frameCount) {
+            didDecodeProperties();
+            m_haveFrameCount = true;
+        }
     }
     return m_frameCount;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to