Title: [216174] trunk/Source/WebCore
Revision
216174
Author
carlo...@webkit.org
Date
2017-05-03 23:14:36 -0700 (Wed, 03 May 2017)

Log Message

REGRESSION(r215686): Incremental reads from SharedBuffer are wrong after r215686
https://bugs.webkit.org/show_bug.cgi?id=171602

Reviewed by Michael Catanzaro.

In TextTrackLoader::processNewCueData() and PNGImageReader::decode() we changed the patter to read data from a
SharedBuffer at a given offset. The new pattern is not correct, because it assumes the whole segment is always
read, and the new offset is not correct when that's not the case. This has broken the rendering of png images in
the GTK+ port, only the first bytes are correctly decoded and drawn, but not the rest of the image.

Fixes: editing/pasteboard/paste-image-using-image-data.html

* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::processNewCueData):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageReader::decode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216173 => 216174)


--- trunk/Source/WebCore/ChangeLog	2017-05-04 05:50:01 UTC (rev 216173)
+++ trunk/Source/WebCore/ChangeLog	2017-05-04 06:14:36 UTC (rev 216174)
@@ -1,3 +1,22 @@
+2017-05-03  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r215686): Incremental reads from SharedBuffer are wrong after r215686
+        https://bugs.webkit.org/show_bug.cgi?id=171602
+
+        Reviewed by Michael Catanzaro.
+
+        In TextTrackLoader::processNewCueData() and PNGImageReader::decode() we changed the patter to read data from a
+        SharedBuffer at a given offset. The new pattern is not correct, because it assumes the whole segment is always
+        read, and the new offset is not correct when that's not the case. This has broken the rendering of png images in
+        the GTK+ port, only the first bytes are correctly decoded and drawn, but not the rest of the image.
+
+        Fixes: editing/pasteboard/paste-image-using-image-data.html
+
+        * loader/TextTrackLoader.cpp:
+        (WebCore::TextTrackLoader::processNewCueData):
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::PNGImageReader::decode):
+
 2017-05-03  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream] Allow host application to enable/disable media capture

Modified: trunk/Source/WebCore/loader/TextTrackLoader.cpp (216173 => 216174)


--- trunk/Source/WebCore/loader/TextTrackLoader.cpp	2017-05-04 05:50:01 UTC (rev 216173)
+++ trunk/Source/WebCore/loader/TextTrackLoader.cpp	2017-05-04 06:14:36 UTC (rev 216174)
@@ -97,9 +97,10 @@
             bytesToSkip -= segment->size();
             continue;
         }
-        m_cueParser->parseBytes(segment->data() + bytesToSkip, segment->size() - bytesToSkip);
+        auto bytesToUse = segment->size() - bytesToSkip;
+        m_cueParser->parseBytes(segment->data() + bytesToSkip, bytesToUse);
         bytesToSkip = 0;
-        m_parseOffset += segment->size();
+        m_parseOffset += bytesToUse;
     }
 }
 

Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (216173 => 216174)


--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp	2017-05-04 05:50:01 UTC (rev 216173)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp	2017-05-04 06:14:36 UTC (rev 216174)
@@ -163,9 +163,10 @@
                 bytesToSkip -= segment->size();
                 continue;
             }
-            m_readOffset += segment->size();
+            auto bytesToUse = segment->size() - bytesToSkip;
+            m_readOffset += bytesToUse;
             m_currentBufferSize = m_readOffset;
-            png_process_data(m_png, m_info, reinterpret_cast<png_bytep>(const_cast<char*>(segment->data() + bytesToSkip)), segment->size() - bytesToSkip);
+            png_process_data(m_png, m_info, reinterpret_cast<png_bytep>(const_cast<char*>(segment->data() + bytesToSkip)), bytesToUse);
             bytesToSkip = 0;
             // We explicitly specify the superclass encodedDataStatus() because we
             // merely want to check if we've managed to set the size, not
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to