avformat/avidec: Check avio_read() return before using the results for meta-data

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-03-05 19:31:56 +01:00
parent 8a048fe6f8
commit 8c013a9e55

View File

@ -308,7 +308,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag,
value = av_malloc(size + 1);
if (!value)
return AVERROR(ENOMEM);
avio_read(pb, value, size);
if (avio_read(pb, value, size) != size)
return AVERROR_INVALIDDATA;
value[size] = 0;
AV_WL32(key, tag);