From 2ac00d2d1d51047c6ce69d5fbe1a08392d142658 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 26 Jul 2016 11:42:11 +0200 Subject: mov: Validate the ID number IDs in MOV start from 1. Signed-off-by: Diego Biurrun --- libavformat/mov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavformat') diff --git a/libavformat/mov.c b/libavformat/mov.c index ff39b58ef1..03427d7e06 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1949,8 +1949,8 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->stsc_data[i].first = avio_rb32(pb); sc->stsc_data[i].count = avio_rb32(pb); sc->stsc_data[i].id = avio_rb32(pb); - if (sc->stsc_data[i].id < 0 || sc->stsc_data[i].id > sc->stsd_count) { - sc->stsc_data[i].id = 0; + if (sc->stsc_data[i].id <= 0 || sc->stsc_data[i].id > sc->stsd_count) { + sc->stsc_data[i].id = 1; if (c->fc->error_recognition & AV_EF_EXPLODE) { av_log(c->fc, AV_LOG_ERROR, "Invalid stsc index.\n"); return AVERROR_INVALIDDATA; -- cgit v1.2.3