Commit a6f5e25a authored by Anssi Hannula's avatar 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
parent 1212e346
...@@ -417,10 +417,10 @@ static struct segment *new_init_section(struct playlist *pls, ...@@ -417,10 +417,10 @@ static struct segment *new_init_section(struct playlist *pls,
} }
if (info->byterange[0]) { if (info->byterange[0]) {
sec->size = atoi(info->byterange); sec->size = strtoll(info->byterange, NULL, 10);
ptr = strchr(info->byterange, '@'); ptr = strchr(info->byterange, '@');
if (ptr) if (ptr)
sec->url_offset = atoi(ptr+1); sec->url_offset = strtoll(ptr+1, NULL, 10);
} else { } else {
/* the entire file is the init section */ /* the entire file is the init section */
sec->size = -1; sec->size = -1;
...@@ -732,7 +732,7 @@ static int parse_playlist(HLSContext *c, const char *url, ...@@ -732,7 +732,7 @@ static int parse_playlist(HLSContext *c, const char *url,
ret = ensure_playlist(c, &pls, url); ret = ensure_playlist(c, &pls, url);
if (ret < 0) if (ret < 0)
goto fail; 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)) { } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
ret = ensure_playlist(c, &pls, url); ret = ensure_playlist(c, &pls, url);
if (ret < 0) if (ret < 0)
...@@ -761,10 +761,10 @@ static int parse_playlist(HLSContext *c, const char *url, ...@@ -761,10 +761,10 @@ static int parse_playlist(HLSContext *c, const char *url,
is_segment = 1; is_segment = 1;
duration = atof(ptr) * AV_TIME_BASE; duration = atof(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#EXT-X-BYTERANGE:", &ptr)) { } else if (av_strstart(line, "#EXT-X-BYTERANGE:", &ptr)) {
seg_size = atoi(ptr); seg_size = strtoll(ptr, NULL, 10);
ptr = strchr(ptr, '@'); ptr = strchr(ptr, '@');
if (ptr) if (ptr)
seg_offset = atoi(ptr+1); seg_offset = strtoll(ptr+1, NULL, 10);
} else if (av_strstart(line, "#", NULL)) { } else if (av_strstart(line, "#", NULL)) {
continue; continue;
} else if (line[0]) { } else if (line[0]) {
......
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