On Wed, Jul 13, 2016 at 9:46 PM, Luca Barbato <[email protected]> wrote:
> On 13/07/16 21:02, Vittorio Giovara wrote:
>> There are samples with invalid stsc that may work fine as is and
>> do not need extradata change. So ignore any out of range index, and
>> error out only when explode is set.
>>
>> Found-by: Matthieu Bouron <[email protected]>
>>
>> Signed-off-by: Vittorio Giovara <[email protected]>
>> ---
>>  libavformat/mov.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index e0673e6..b8dd30a 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -1949,8 +1949,11 @@ 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 > sc->stsd_count)
>> -            return AVERROR_INVALIDDATA;
>> +        if (sc->stsc_data[i].id < 0 || sc->stsc_data[i].id > 
>> sc->stsd_count) {
>> +            sc->stsc_data[i].id = 0;
>> +            if (c->fc->error_recognition & AV_EF_EXPLODE)
>> +                return AVERROR_INVALIDDATA;
>> +        }
>>      }
>>
>>      sc->stsc_count = i;
>>
>
> Probably Ok.

i'd like to add a log line in the explode case,
+                av_log(c->fc, AV_LOG_ERROR, "Invalid stsc index.");

is it still ok?

-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to