Title: [226638] trunk
Revision
226638
Author
[email protected]
Date
2018-01-09 08:44:44 -0800 (Tue, 09 Jan 2018)

Log Message

Check Image::m_image is not null in ImageLoader::decode()
https://bugs.webkit.org/show_bug.cgi?id=180386
<rdar://problem/34634483>

Patch by Said Abou-Hallawa <[email protected]> on 2018-01-09
Reviewed by Tim Horton.

Source/WebCore:

Ensure ImageLoader::m_image is not null before referencing it.

* loader/ImageLoader.cpp:
(WebCore::ImageLoader::decode):

LayoutTests:

Add a new rejected case for decoding an image with an invalid URL.

* fast/images/decode-static-image-reject-expected.txt:
* fast/images/decode-static-image-reject.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226637 => 226638)


--- trunk/LayoutTests/ChangeLog	2018-01-09 16:30:44 UTC (rev 226637)
+++ trunk/LayoutTests/ChangeLog	2018-01-09 16:44:44 UTC (rev 226638)
@@ -1,3 +1,16 @@
+2018-01-09  Said Abou-Hallawa  <[email protected]>
+
+        Check Image::m_image is not null in ImageLoader::decode()
+        https://bugs.webkit.org/show_bug.cgi?id=180386
+        <rdar://problem/34634483>
+
+        Reviewed by Tim Horton.
+
+        Add a new rejected case for decoding an image with an invalid URL.
+
+        * fast/images/decode-static-image-reject-expected.txt:
+        * fast/images/decode-static-image-reject.html:
+
 2018-01-09  Ali Juma  <[email protected]>
 
         Mark imported/w3c/web-platform-tests/viewport/viewport-resize-event-on-load-overflowing-page.html as flaky

Modified: trunk/LayoutTests/fast/images/decode-static-image-reject-expected.txt (226637 => 226638)


--- trunk/LayoutTests/fast/images/decode-static-image-reject-expected.txt	2018-01-09 16:30:44 UTC (rev 226637)
+++ trunk/LayoutTests/fast/images/decode-static-image-reject-expected.txt	2018-01-09 16:44:44 UTC (rev 226638)
@@ -6,6 +6,7 @@
 Failed to decode image with no source. Result is: EncodingError: Missing source URL.
 Failed to decode image with non-existent source. Result is: EncodingError: Loading error.
 Failed to decode image with unsupported image format. Result is: EncodingError: Loading error.
+Failed to decode image with invalid URL. Result is: EncodingError: Loading error.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/images/decode-static-image-reject.html (226637 => 226638)


--- trunk/LayoutTests/fast/images/decode-static-image-reject.html	2018-01-09 16:30:44 UTC (rev 226637)
+++ trunk/LayoutTests/fast/images/decode-static-image-reject.html	2018-01-09 16:44:44 UTC (rev 226638)
@@ -21,6 +21,11 @@
         })
         .catch(reason => {
             debug("Failed to decode image with unsupported image format. Result is: " + reason);
+            image.src = ""
+            return image.decode();
+        })
+        .catch(reason => {
+            debug("Failed to decode image with invalid URL. Result is: " + reason);
             finishJSTest();
         });
     </script>

Modified: trunk/Source/WebCore/ChangeLog (226637 => 226638)


--- trunk/Source/WebCore/ChangeLog	2018-01-09 16:30:44 UTC (rev 226637)
+++ trunk/Source/WebCore/ChangeLog	2018-01-09 16:44:44 UTC (rev 226638)
@@ -1,3 +1,16 @@
+2018-01-09  Said Abou-Hallawa  <[email protected]>
+
+        Check Image::m_image is not null in ImageLoader::decode()
+        https://bugs.webkit.org/show_bug.cgi?id=180386
+        <rdar://problem/34634483>
+
+        Reviewed by Tim Horton.
+
+        Ensure ImageLoader::m_image is not null before referencing it.
+
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::decode):
+
 2018-01-09  Yusuke Suzuki  <[email protected]>
 
         [FreeType] Use FastMalloc for FreeType

Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (226637 => 226638)


--- trunk/Source/WebCore/loader/ImageLoader.cpp	2018-01-09 16:30:44 UTC (rev 226637)
+++ trunk/Source/WebCore/loader/ImageLoader.cpp	2018-01-09 16:44:44 UTC (rev 226638)
@@ -412,12 +412,12 @@
         return;
     }
 
-    Image* image = m_image->image();
-    if (!image || m_image->errorOccurred()) {
+    if (!m_image || !m_image->image() || m_image->errorOccurred()) {
         decodeError("Loading error.");
         return;
     }
 
+    Image* image = m_image->image();
     if (!image->isBitmapImage()) {
         decodeError("Invalid image type.");
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to