[vlc-commits] hls: Fix parse_SegmentInformation error checking.

Hugo Beauzée-Luyssen git at videolan.org
Mon Mar 12 16:28:28 CET 2012


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Mar 12 16:22:10 2012 +0100| [fc50e57ad33d9ede13e435267e9dda3d30501711] | committer: Hugo Beauzée-Luyssen

hls: Fix parse_SegmentInformation error checking.

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

 modules/stream_filter/httplive.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index b4ed58d..7c72abd 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -34,6 +34,7 @@
 #include <vlc_plugin.h>
 
 #include <assert.h>
+#include <errno.h>
 #include <gcrypt.h>
 
 #include <vlc_threads.h>
@@ -576,8 +577,9 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati
     char *endptr;
     if (hls->version < 3)
     {
+       errno = 0;
        value = strtol(token, &endptr, 10);
-       if (token == endptr)
+       if (token == endptr || errno == ERANGE )
        {
            *duration = -1;
            return VLC_EGENERIC;
@@ -586,8 +588,9 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati
     }
     else
     {
+        errno = 0;
         double d = strtof(token, &endptr);
-        if (token == endptr)
+        if (token == endptr || errno == ERANGE )
         {
             *duration = -1;
             return VLC_EGENERIC;



More information about the vlc-commits mailing list