Title: [176474] trunk/Source/WebKit2
Revision
176474
Author
timothy_hor...@apple.com
Date
2014-11-21 15:10:59 -0800 (Fri, 21 Nov 2014)

Log Message

Crashes while encoding a TextIndicator with no contentImageWithHighlight
https://bugs.webkit.org/show_bug.cgi?id=138984
<rdar://problem/19063717>

Reviewed by Sam Weinig.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<TextIndicatorData>::encode):
(IPC::ArgumentCoder<TextIndicatorData>::decode):
encodeImage doesn't deal with null images, so handle that case gracefully.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (176473 => 176474)


--- trunk/Source/WebKit2/ChangeLog	2014-11-21 22:33:17 UTC (rev 176473)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-21 23:10:59 UTC (rev 176474)
@@ -1,5 +1,18 @@
 2014-11-21  Tim Horton  <timothy_hor...@apple.com>
 
+        Crashes while encoding a TextIndicator with no contentImageWithHighlight
+        https://bugs.webkit.org/show_bug.cgi?id=138984
+        <rdar://problem/19063717>
+
+        Reviewed by Sam Weinig.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<TextIndicatorData>::encode):
+        (IPC::ArgumentCoder<TextIndicatorData>::decode):
+        encodeImage doesn't deal with null images, so handle that case gracefully.
+
+2014-11-21  Tim Horton  <timothy_hor...@apple.com>
+
         REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
         https://bugs.webkit.org/show_bug.cgi?id=138960
         <rdar://problem/19056715>

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (176473 => 176474)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2014-11-21 22:33:17 UTC (rev 176473)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2014-11-21 23:10:59 UTC (rev 176474)
@@ -1968,8 +1968,16 @@
     encoder << textIndicatorData.textRectsInBoundingRectCoordinates;
     encoder << textIndicatorData.contentImageScaleFactor;
     encoder.encodeEnum(textIndicatorData.presentationTransition);
-    encodeImage(encoder, textIndicatorData.contentImage.get());
-    encodeImage(encoder, textIndicatorData.contentImageWithHighlight.get());
+
+    bool hasImage = textIndicatorData.contentImage;
+    encoder << hasImage;
+    if (hasImage)
+        encodeImage(encoder, textIndicatorData.contentImage.get());
+
+    bool hasImageWithHighlight = textIndicatorData.contentImageWithHighlight;
+    encoder << hasImageWithHighlight;
+    if (hasImageWithHighlight)
+        encodeImage(encoder, textIndicatorData.contentImageWithHighlight.get());
 }
 
 bool ArgumentCoder<TextIndicatorData>::decode(ArgumentDecoder& decoder, TextIndicatorData& textIndicatorData)
@@ -1989,11 +1997,17 @@
     if (!decoder.decodeEnum(textIndicatorData.presentationTransition))
         return false;
 
-    if (!decodeImage(decoder, textIndicatorData.contentImage))
+    bool hasImage;
+    if (!decoder.decode(hasImage))
         return false;
+    if (hasImage && !decodeImage(decoder, textIndicatorData.contentImage))
+        return false;
 
-    if (!decodeImage(decoder, textIndicatorData.contentImageWithHighlight))
+    bool hasImageWithHighlight;
+    if (!decoder.decode(hasImageWithHighlight))
         return false;
+    if (hasImageWithHighlight && !decodeImage(decoder, textIndicatorData.contentImageWithHighlight))
+        return false;
 
     return true;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to