avformat/sierravmd: Check avio_read return value

Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f82af392dae_1848_HR060606.VMD
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-12-19 20:48:51 +01:00
parent 200cfab8c4
commit a165964f3c

View File

@ -204,7 +204,12 @@ static int vmd_read_header(AVFormatContext *s)
int type;
uint32_t size;
avio_read(pb, chunk, BYTES_PER_FRAME_RECORD);
if ((ret = avio_read(pb, chunk, BYTES_PER_FRAME_RECORD)) != BYTES_PER_FRAME_RECORD) {
av_log(s, AV_LOG_ERROR, "Failed to read frame record\n");
if (ret >= 0)
ret = AVERROR_INVALIDDATA;
goto error;
}
type = chunk[0];
size = AV_RL32(&chunk[2]);
if (size > INT_MAX / 2) {