aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rmdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-26 16:18:09 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-26 16:18:09 +0200
commitc01a462cda8d7f298a3ac6d20752d23a11e43a8a (patch)
tree987da0eb09f6133a632844de1877a2db18dc656b /libavformat/rmdec.c
parent1bf50711042ca72b6abd11bf236f87633c147dd3 (diff)
downloadffmpeg-c01a462cda8d7f298a3ac6d20752d23a11e43a8a.tar.gz
rmdec: fix null derefercne
Fixes CID733714 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r--libavformat/rmdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 87573d7cf0..a2c8bfbe9c 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -839,7 +839,8 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
ast->deint_id == DEINT_ID_VBRS)
av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]);
else {
- av_new_packet(pkt, st->codec->block_align);
+ if(av_new_packet(pkt, st->codec->block_align) < 0)
+ return AVERROR(ENOMEM);
memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME avoid this
(ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt),
st->codec->block_align);
@@ -867,7 +868,9 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
if (rm->audio_pkt_cnt) {
// If there are queued audio packet return them first
st = s->streams[rm->audio_stream_num];
- ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
+ res = ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
+ if(res < 0)
+ return res;
flags = 0;
} else {
if (rm->old_format) {