aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rmdec.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-17 22:46:40 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-23 00:57:10 +0100
commitde4ded06366e5767d0af277a61d9a56b8c8f9c19 (patch)
tree969312d7ce9a205d11a92be53a8cc7cdfc2444e2 /libavformat/rmdec.c
parent946ecd19ea752399bccc751c9339ff74b815587e (diff)
downloadffmpeg-de4ded06366e5767d0af277a61d9a56b8c8f9c19.tar.gz
rmdec: validate block alignment
This fixes division by zero crashes. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r--libavformat/rmdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index d1758628ad..4d565291af 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -934,6 +934,10 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
ast->sub_packet_cnt = 0;
rm->audio_stream_num = st->index;
+ if (st->codecpar->block_align <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid block alignment %d\n", st->codecpar->block_align);
+ return AVERROR_INVALIDDATA;
+ }
rm->audio_pkt_cnt = h * w / st->codecpar->block_align;
} else if ((ast->deint_id == DEINT_ID_VBRF) ||
(ast->deint_id == DEINT_ID_VBRS)) {