changeset 5513:f4eceb1eb100 libavformat

mkvdec: Avoid divide-by-zero crash on invalid real audio tracks
author conrad
date Mon, 11 Jan 2010 00:31:55 +0000
parents 60671fac35ad
children 52c7b29eca31
files matroskadec.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Mon Jan 11 00:31:52 2010 +0000
+++ b/matroskadec.c	Mon Jan 11 00:31:55 2010 +0000
@@ -1634,9 +1634,10 @@
 
     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;