Commit 161dee43 authored by Michael Niedermayer's avatar Michael Niedermayer

rmdec: dont return uninitialized data

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fe1de12f
...@@ -662,6 +662,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, ...@@ -662,6 +662,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
int hdr; int hdr;
int seq = 0, pic_num = 0, len2 = 0, pos = 0; //init to silcense compiler warning int seq = 0, pic_num = 0, len2 = 0, pos = 0; //init to silcense compiler warning
int type; int type;
int ret;
hdr = avio_r8(pb); len--; hdr = avio_r8(pb); len--;
type = hdr >> 6; type = hdr >> 6;
...@@ -690,7 +691,10 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, ...@@ -690,7 +691,10 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
pkt->data[0] = 0; pkt->data[0] = 0;
AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 1, 1);
AV_WL32(pkt->data + 5, 0); AV_WL32(pkt->data + 5, 0);
avio_read(pb, pkt->data + 9, len); if ((ret = avio_read(pb, pkt->data + 9, len)) != len) {
av_free_packet(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
return 0; return 0;
} }
//now we have to deal with single slice //now we have to deal with single slice
...@@ -706,6 +710,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, ...@@ -706,6 +710,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
av_free_packet(&vst->pkt); //FIXME this should be output. av_free_packet(&vst->pkt); //FIXME this should be output.
if(av_new_packet(&vst->pkt, vst->videobufsize) < 0) if(av_new_packet(&vst->pkt, vst->videobufsize) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
memset(vst->pkt.data, 0, vst->pkt.size);
vst->videobufpos = 8*vst->slices + 1; vst->videobufpos = 8*vst->slices + 1;
vst->cur_slice = 0; vst->cur_slice = 0;
vst->curpic_num = pic_num; vst->curpic_num = pic_num;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment