aboutsummaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorDavid Conrad2010-01-11 00:31:55 +0000
committerDavid Conrad2010-01-11 00:31:55 +0000
commit18ca491bf13b76fc022373110ccac385fee0557c (patch)
treeac9f0614f6c972d4d3ded6d7ed04d66a91b1e9d8 /libavformat/matroskadec.c
parent24ca518bd1553e2e73d31b9f93df4fb7219606ff (diff)
mkvdec: Avoid divide-by-zero crash on invalid real audio tracks
Originally committed as revision 21129 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 688169a8b6..59dc166734 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1634,9 +1634,10 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (res == 0) {
for (n = 0; n < laces; n++) {
- if (st->codec->codec_id == CODEC_ID_RA_288 ||
- st->codec->codec_id == CODEC_ID_COOK ||
- st->codec->codec_id == CODEC_ID_ATRAC3) {
+ if ((st->codec->codec_id == CODEC_ID_RA_288 ||
+ st->codec->codec_id == CODEC_ID_COOK ||
+ st->codec->codec_id == CODEC_ID_ATRAC3) &&
+ st->codec->block_align && track->audio.sub_packet_size) {
int a = st->codec->block_align;
int sps = track->audio.sub_packet_size;
int cfs = track->audio.coded_framesize;