Title: [199764] trunk/Source/WebCore
Revision
199764
Author
[email protected]
Date
2016-04-19 23:02:24 -0700 (Tue, 19 Apr 2016)

Log Message

REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData since r198782
https://bugs.webkit.org/show_bug.cgi?id=156690

Reviewed by Michael Catanzaro.

The assertion is wrong, because it assumes that ImageDecoder::create() always returns a valid pointer, which is
only true for the CG implementation. The non CG implementation can return nullptr if there isn't enough data to
figure out the image format or if the image format is not supported. This is causing several crashes in the
debug bots.

* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::setData): Remove the invalid ASSERT and return early if we fail to create the decoder.
(WebCore::ImageSource::ensureDecoderIsCreated): Deleted.
* platform/graphics/ImageSource.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199763 => 199764)


--- trunk/Source/WebCore/ChangeLog	2016-04-20 05:49:31 UTC (rev 199763)
+++ trunk/Source/WebCore/ChangeLog	2016-04-20 06:02:24 UTC (rev 199764)
@@ -1,3 +1,20 @@
+2016-04-19  Carlos Garcia Campos  <[email protected]>
+
+        REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData since r198782
+        https://bugs.webkit.org/show_bug.cgi?id=156690
+
+        Reviewed by Michael Catanzaro.
+
+        The assertion is wrong, because it assumes that ImageDecoder::create() always returns a valid pointer, which is
+        only true for the CG implementation. The non CG implementation can return nullptr if there isn't enough data to
+        figure out the image format or if the image format is not supported. This is causing several crashes in the
+        debug bots.
+
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::setData): Remove the invalid ASSERT and return early if we fail to create the decoder.
+        (WebCore::ImageSource::ensureDecoderIsCreated): Deleted.
+        * platform/graphics/ImageSource.h:
+
 2016-04-19  Brent Fulgham  <[email protected]>
 
         Remove remaining bits of dynamic <link> rel='icon' loading

Modified: trunk/Source/WebCore/platform/graphics/ImageSource.cpp (199763 => 199764)


--- trunk/Source/WebCore/platform/graphics/ImageSource.cpp	2016-04-20 05:49:31 UTC (rev 199763)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.cpp	2016-04-20 06:02:24 UTC (rev 199764)
@@ -71,28 +71,18 @@
         setData(data, allDataReceived);
 }
 
-void ImageSource::ensureDecoderIsCreated(const SharedBuffer& data)
-{
-    if (initialized())
-        return;
-    
-    m_decoder = ImageDecoder::create(data, m_alphaOption, m_gammaAndColorProfileOption);
-}
-
 void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
 {
     if (!data)
         return;
-    
-    ensureDecoderIsCreated(*data);
-    
+
     if (!initialized()) {
-        ASSERT_NOT_REACHED();
-        return;
+        m_decoder = ImageDecoder::create(*data, m_alphaOption, m_gammaAndColorProfileOption);
+        if (!m_decoder)
+            return;
     }
 
-    if (m_decoder)
-        m_decoder->setData(*data, allDataReceived);
+    m_decoder->setData(*data, allDataReceived);
 }
 
 SubsamplingLevel ImageSource::calculateMaximumSubsamplingLevel() const

Modified: trunk/Source/WebCore/platform/graphics/ImageSource.h (199763 => 199764)


--- trunk/Source/WebCore/platform/graphics/ImageSource.h	2016-04-20 05:49:31 UTC (rev 199763)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.h	2016-04-20 06:02:24 UTC (rev 199764)
@@ -144,7 +144,6 @@
     
 private:
     void clearFrameBufferCache(size_t);
-    void ensureDecoderIsCreated(const SharedBuffer&);
     SubsamplingLevel calculateMaximumSubsamplingLevel() const;
     void dump(TextStream&) const;
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to