aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/asfdec.c
diff options
context:
space:
mode:
authorJohn Stebbins <stebbins@jetheaddev.com>2017-02-23 16:47:58 -0700
committerJohn Stebbins <stebbins@jetheaddev.com>2017-02-24 11:41:33 -0700
commitcd7a2e1502f174c725c0de82711d2c7649057574 (patch)
tree36eae2bb2c8cae3ee02cf42f7d751ac070cfd242 /libavformat/asfdec.c
parent248dc5c1646dcdd96fe79761105c4ae889e711fd (diff)
downloadffmpeg-cd7a2e1502f174c725c0de82711d2c7649057574.tar.gz
asfdec: fix reading files larger than 2GB
avio_skip returns file position and overflows int
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r--libavformat/asfdec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 34730b20aa..9e1f8f6b62 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -976,7 +976,8 @@ static int asf_read_simple_index(AVFormatContext *s, const GUIDParseTable *g)
uint64_t interval; // index entry time interval in 100 ns units, usually it's 1s
uint32_t pkt_num, nb_entries;
int32_t prev_pkt_num = -1;
- int i, ret;
+ int i;
+ int64_t offset;
uint64_t size = avio_rl64(pb);
// simple index objects should be ordered by stream number, this loop tries to find
@@ -998,10 +999,10 @@ static int asf_read_simple_index(AVFormatContext *s, const GUIDParseTable *g)
nb_entries = avio_rl32(pb);
for (i = 0; i < nb_entries; i++) {
pkt_num = avio_rl32(pb);
- ret = avio_skip(pb, 2);
- if (ret < 0) {
+ offset = avio_skip(pb, 2);
+ if (offset < 0) {
av_log(s, AV_LOG_ERROR, "Skipping failed in asf_read_simple_index.\n");
- return ret;
+ return offset;
}
if (prev_pkt_num != pkt_num) {
av_add_index_entry(st, asf->first_packet_offset + asf->packet_size *