[FFmpeg-cvslog] avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GB

Anssi Hannula git at videolan.org
Sat Sep 24 10:02:45 EEST 2016


ffmpeg | branch: release/3.1 | Anssi Hannula <anssi.hannula at iki.fi> | Sat Sep 24 09:29:03 2016 +0300| [748a4747da5a9fce15efb95b2d650d647cb98c1d] | committer: Anssi Hannula

avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GB

Replace uses of atoi() with strtoll() when trying to read values into
int64_t variables.

Fixes Kodi trac #16926:
http://trac.kodi.tv/ticket/16926

(cherry picked from commit a6f5e25ad989550dff9493311d6ba08d882df079)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=748a4747da5a9fce15efb95b2d650d647cb98c1d
---

 libavformat/hls.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 59f5e38..7241532 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -416,10 +416,10 @@ static struct segment *new_init_section(struct playlist *pls,
     }
 
     if (info->byterange[0]) {
-        sec->size = atoi(info->byterange);
+        sec->size = strtoll(info->byterange, NULL, 10);
         ptr = strchr(info->byterange, '@');
         if (ptr)
-            sec->url_offset = atoi(ptr+1);
+            sec->url_offset = strtoll(ptr+1, NULL, 10);
     } else {
         /* the entire file is the init section */
         sec->size = -1;
@@ -731,7 +731,7 @@ static int parse_playlist(HLSContext *c, const char *url,
             ret = ensure_playlist(c, &pls, url);
             if (ret < 0)
                 goto fail;
-            pls->target_duration = atoi(ptr) * AV_TIME_BASE;
+            pls->target_duration = strtoll(ptr, NULL, 10) * AV_TIME_BASE;
         } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
             ret = ensure_playlist(c, &pls, url);
             if (ret < 0)
@@ -760,10 +760,10 @@ static int parse_playlist(HLSContext *c, const char *url,
             is_segment = 1;
             duration   = atof(ptr) * AV_TIME_BASE;
         } else if (av_strstart(line, "#EXT-X-BYTERANGE:", &ptr)) {
-            seg_size = atoi(ptr);
+            seg_size = strtoll(ptr, NULL, 10);
             ptr = strchr(ptr, '@');
             if (ptr)
-                seg_offset = atoi(ptr+1);
+                seg_offset = strtoll(ptr+1, NULL, 10);
         } else if (av_strstart(line, "#", NULL)) {
             continue;
         } else if (line[0]) {



More information about the ffmpeg-cvslog mailing list