Browse Source

avformat/iff: fix memleak of packet

Fixes: msan_uninit-mem_7f65b9788da6_388_24.iff
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
6f9be91063
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavformat/iff.c

+ 3
- 1
libavformat/iff.c View File

@@ -462,7 +462,9 @@ static int iff_read_packet(AVFormatContext *s,
buf = pkt->data; buf = pkt->data;
bytestream_put_be16(&buf, 2); bytestream_put_be16(&buf, 2);
ret = avio_read(pb, buf, iff->body_size); ret = avio_read(pb, buf, iff->body_size);
if (ret>=0 && ret < iff->body_size)
if (ret<0) {
av_free_packet(pkt);
} else if (ret < iff->body_size)
av_shrink_packet(pkt, ret + 2); av_shrink_packet(pkt, ret + 2);
} else { } else {
av_assert0(0); av_assert0(0);


Loading…
Cancel
Save