[geary] Fix a crash when loading an image with an invalid URI.



commit e36b720546a944c0ee1a371f0d79621b69dd1c3a
Author: Michael James Gratton <mike vee net>
Date:   Wed Oct 19 09:46:36 2016 +1100

    Fix a crash when loading an image with an invalid URI.

 .../conversation-viewer/conversation-web-view.vala |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-web-view.vala 
b/src/client/conversation-viewer/conversation-web-view.vala
index 8df34c2..5d9bb25 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -143,10 +143,17 @@ public class ConversationWebView : StylishWebView {
 
         string? uri = request.get_uri();
         if (uri != null && !is_always_loaded(uri)) {
-            if (uri.has_prefix(allow_prefix))
-                request.set_uri(uri.substring(allow_prefix.length));
-            else
+            if (uri.has_prefix(allow_prefix)) {
+                // webkit_network_request_set_uri() will crash with
+                // "assertion 'soupURI' failed" if the string passed
+                // in is not a validi-sh URI, so check first
+                string allowed_uri = uri.substring(this.allow_prefix.length);
+                if (new Soup.URI(allowed_uri) != null) {
+                    request.set_uri(allowed_uri);
+                }
+            } else {
                 request.set_uri("about:blank");
+            }
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]