vlc | branch: master | Rafaël Carré <[email protected]> | Thu Apr 25 18:28:59 
2013 +0200| [399c991f196797f7614439a00c32f4f2d296e737] | committer: Rafaël Carré

HLS demux: fix crash on invalid playlist

Close #8498

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=399c991f196797f7614439a00c32f4f2d296e737
---

 modules/stream_filter/httplive.c |   44 +++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index e51c740..5f85e2f 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1000,30 +1000,30 @@ static int parse_M3U8(stream_t *s, vlc_array_t 
*streams, uint8_t *buffer, const
 
                         free(uri);
 
-                        /* Download playlist file from server */
-                        uint8_t *buf = NULL;
-                        ssize_t len = read_M3U8_from_url(s, hls->url, &buf);
-                        if (len < 0)
-                        {
-                            msg_Warn(s, "failed to read %s, continue for other 
streams", hls->url);
-                            failed_to_download_stream_m3u8 = true;
-
-                            /* remove stream just added */
-                            if (new_stream_added)
-                                vlc_array_remove(streams, 
vlc_array_count(streams) - 1);
-
-                            /* ignore download error, so we have chance to try 
other streams */
-                            err = VLC_SUCCESS;
-                        }
-                        else
-                        {
-                            /* Parse HLS m3u8 content. */
-                            err = parse_M3U8(s, streams, buf, len);
-                            free(buf);
-                        }
-
                         if (hls)
                         {
+                            /* Download playlist file from server */
+                            uint8_t *buf = NULL;
+                            ssize_t len = read_M3U8_from_url(s, hls->url, 
&buf);
+                            if (len < 0)
+                            {
+                                msg_Warn(s, "failed to read %s, continue for 
other streams", hls->url);
+                                failed_to_download_stream_m3u8 = true;
+
+                                /* remove stream just added */
+                                if (new_stream_added)
+                                    vlc_array_remove(streams, 
vlc_array_count(streams) - 1);
+
+                                /* ignore download error, so we have chance to 
try other streams */
+                                err = VLC_SUCCESS;
+                            }
+                            else
+                            {
+                                /* Parse HLS m3u8 content. */
+                                err = parse_M3U8(s, streams, buf, len);
+                                free(buf);
+                            }
+
                             hls->version = version;
                             if (!p_sys->b_live)
                                 hls->size = hls_GetStreamSize(hls); /* Stream 
size (approximate) */

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to