changeset 10238:b18b8aadb87a libavcodec

Sanity checks for magnitude and angle. 26_vorbis_mag_angle_index.patch by chrome
author michael
date Wed, 23 Sep 2009 10:40:33 +0000
parents 2355ca5dc57c
children 77246a6cffa0
files vorbis_dec.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_dec.c	Wed Sep 23 10:33:49 2009 +0000
+++ b/vorbis_dec.c	Wed Sep 23 10:40:33 2009 +0000
@@ -697,7 +697,14 @@
             for(j=0;j<mapping_setup->coupling_steps;++j) {
                 mapping_setup->magnitude[j]=get_bits(gb, ilog(vc->audio_channels-1));
                 mapping_setup->angle[j]=get_bits(gb, ilog(vc->audio_channels-1));
-                // FIXME: sanity checks
+                if (mapping_setup->magnitude[j]>=vc->audio_channels) {
+                    av_log(vc->avccontext, AV_LOG_ERROR, "magnitude channel %d out of range. \n", mapping_setup->magnitude[j]);
+                    return 1;
+                }
+                if (mapping_setup->angle[j]>=vc->audio_channels) {
+                    av_log(vc->avccontext, AV_LOG_ERROR, "angle channel %d out of range. \n", mapping_setup->angle[j]);
+                    return 1;
+                }
             }
         } else {
             mapping_setup->coupling_steps=0;