Commit 898c4c30 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

hls: Fix parse_SegmentInformation error checking.

(cherry picked from commit fc50e57ad33d9ede13e435267e9dda3d30501711)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8022324c
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <gcrypt.h> #include <gcrypt.h>
#include <vlc_threads.h> #include <vlc_threads.h>
...@@ -577,8 +578,9 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati ...@@ -577,8 +578,9 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati
char *endptr; char *endptr;
if (hls->version < 3) if (hls->version < 3)
{ {
errno = 0;
value = strtol(token, &endptr, 10); value = strtol(token, &endptr, 10);
if (token == endptr) if (token == endptr || errno == ERANGE )
{ {
*duration = -1; *duration = -1;
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -587,8 +589,9 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati ...@@ -587,8 +589,9 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati
} }
else else
{ {
errno = 0;
double d = strtof(token, &endptr); double d = strtof(token, &endptr);
if (token == endptr) if (token == endptr || errno == ERANGE )
{ {
*duration = -1; *duration = -1;
return VLC_EGENERIC; return VLC_EGENERIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment