1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
(cherry picked from commit de4ded0636)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2016-11-17 22:46:40 +01:00
parent 53e1493cb5
commit e2de6f31c0

View File

@ -933,6 +933,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)) {