Changeset 199764 in webkit


Ignore:
Timestamp:
Apr 19, 2016 11:02:24 PM (8 years ago)
Author:
Carlos Garcia Campos
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199752 r199764  
     12016-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData since r198782
     4        https://bugs.webkit.org/show_bug.cgi?id=156690
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The assertion is wrong, because it assumes that ImageDecoder::create() always returns a valid pointer, which is
     9        only true for the CG implementation. The non CG implementation can return nullptr if there isn't enough data to
     10        figure out the image format or if the image format is not supported. This is causing several crashes in the
     11        debug bots.
     12
     13        * platform/graphics/ImageSource.cpp:
     14        (WebCore::ImageSource::setData): Remove the invalid ASSERT and return early if we fail to create the decoder.
     15        (WebCore::ImageSource::ensureDecoderIsCreated): Deleted.
     16        * platform/graphics/ImageSource.h:
     17
    1182016-04-19  Brent Fulgham  <bfulgham@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/ImageSource.cpp

    r199312 r199764  
    7272}
    7373
    74 void ImageSource::ensureDecoderIsCreated(const SharedBuffer& data)
    75 {
    76     if (initialized())
    77         return;
    78    
    79     m_decoder = ImageDecoder::create(data, m_alphaOption, m_gammaAndColorProfileOption);
    80 }
    81 
    8274void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
    8375{
    8476    if (!data)
    8577        return;
    86    
    87     ensureDecoderIsCreated(*data);
    88    
     78
    8979    if (!initialized()) {
    90         ASSERT_NOT_REACHED();
    91         return;
     80        m_decoder = ImageDecoder::create(*data, m_alphaOption, m_gammaAndColorProfileOption);
     81        if (!m_decoder)
     82            return;
    9283    }
    9384
    94     if (m_decoder)
    95         m_decoder->setData(*data, allDataReceived);
     85    m_decoder->setData(*data, allDataReceived);
    9686}
    9787
  • trunk/Source/WebCore/platform/graphics/ImageSource.h

    r199312 r199764  
    145145private:
    146146    void clearFrameBufferCache(size_t);
    147     void ensureDecoderIsCreated(const SharedBuffer&);
    148147    SubsamplingLevel calculateMaximumSubsamplingLevel() const;
    149148    void dump(TextStream&) const;
Note: See TracChangeset for help on using the changeset viewer.