[grilo-plugins/wip/hadess/fix-atom-podcasts-crash: 4/4] podcasts: Fix crash trying to parse unsupported format



commit 2aaf88255fad99c8d491b3db74f5ba37e12c9467
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 11 22:11:21 2019 +0100

    podcasts: Fix crash trying to parse unsupported format
    
    1. Add an Atom feed to the Podcasts plugin
    2. Try to browse that Atom feed
    3. RSS parser crashes as it doesn't know how to parse Atom
    
    ==8560== Invalid read of size 8
    ==8560==    at 0x1BBD36DF: parse_feed (grl-podcasts.c:1274)
    ==8560==    by 0x1BBD36DF: read_feed_cb (grl-podcasts.c:1365)
    ==8560==    by 0x1BBD1272: read_done_cb (grl-podcasts.c:494)
    ==8560==    by 0x52F1A69: g_simple_async_result_complete (in /usr/lib64/libgio-2.0.so.0.5800.3)
    ==8560==    by 0x1BB48D2F: read_async_cb (grl-net-wc.c:619)
    ==8560==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

 src/podcasts/grl-podcasts.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c
index a9e045e..6c91e80 100644
--- a/src/podcasts/grl-podcasts.c
+++ b/src/podcasts/grl-podcasts.c
@@ -1269,6 +1269,13 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
   xmlXPathFreeObject (xpathObj);
   xpathObj = NULL;
 
+  if(podcast_data == NULL) {
+    *error = g_error_new_literal (GRL_CORE_ERROR,
+                                  os->error_code,
+                                  _("Failed to parse podcast contents"));
+    goto free_resources;
+  }
+
   /* Check podcast pubDate (if available), if it has not been updated
      recently then we can use the cache and avoid parsing the feed */
   if (podcast_data->published != NULL) {


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