avformat/swfdec: check avio_read() return code
Fixes use of uninitialized memory Fixes part of msan_uninit-mem_7f055dd0ab1b_9558_videopop_guitar_300k.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -455,10 +455,20 @@ bitmap_end_skip:
|
|||||||
/* old SWF files containing SOI/EOI as data start */
|
/* old SWF files containing SOI/EOI as data start */
|
||||||
/* files created by swink have reversed tag */
|
/* files created by swink have reversed tag */
|
||||||
pkt->size -= 4;
|
pkt->size -= 4;
|
||||||
avio_read(pb, pkt->data, pkt->size);
|
res = avio_read(pb, pkt->data, pkt->size);
|
||||||
} else {
|
} else {
|
||||||
avio_read(pb, pkt->data + 4, pkt->size - 4);
|
res = avio_read(pb, pkt->data + 4, pkt->size - 4);
|
||||||
|
if (res >= 0)
|
||||||
|
res += 4;
|
||||||
}
|
}
|
||||||
|
if (res != pkt->size) {
|
||||||
|
if (res < 0) {
|
||||||
|
av_free_packet(pkt);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
av_shrink_packet(pkt, res);
|
||||||
|
}
|
||||||
|
|
||||||
pkt->pos = pos;
|
pkt->pos = pos;
|
||||||
pkt->stream_index = st->index;
|
pkt->stream_index = st->index;
|
||||||
return pkt->size;
|
return pkt->size;
|
||||||
|
Reference in New Issue
Block a user