Browse Source

avformat/mov: check avio_read() return in mov_read_dref()

Fixes: msan_uninit-mem_7f4960453a02_7264_mr_cork_jpeg.mov
Fixes use of uninitialized memory
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.2-rc1
Michael Niedermayer 11 years ago
parent
commit
4156df59f5
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavformat/mov.c

+ 2
- 1
libavformat/mov.c View File

@@ -537,7 +537,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dref->dir = av_malloc(len+1); dref->dir = av_malloc(len+1);
if (!dref->dir) if (!dref->dir)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avio_read(pb, dref->dir, len);
if (avio_read(pb, dref->dir, len) != len)
return AVERROR_INVALIDDATA;
dref->dir[len] = 0; dref->dir[len] = 0;
for (j = 0; j < len; j++) for (j = 0; j < len; j++)
if (dref->dir[j] == ':') if (dref->dir[j] == ':')


Loading…
Cancel
Save