[FFmpeg-trac] #1064(FFmpeg:new): Div/0 integer exception cased in aiffdec.c for A-Law AIFFs

FFmpeg trac at avcodec.org
Tue Mar 13 22:28:48 CET 2012


#1064: Div/0 integer exception cased in aiffdec.c for A-Law AIFFs
-----------------------------------+--------------------------------------
             Reporter:  dmitrykos  |                     Type:  defect
               Status:  new        |                 Priority:  critical
            Component:  FFmpeg     |                  Version:  git-master
             Keywords:             |               Blocked By:
             Blocking:             |  Reproduced by developer:  0
Analyzed by developer:  0          |
-----------------------------------+--------------------------------------
 Hi,

 Divizion by 0 integer exception is raised in aiffdec.c, line 163:

 {{{
     codec->bit_rate = codec->sample_rate * (codec->block_align << 3) /
                       aiff->block_duration;
 }}}

 if AIFF file is in A-Law format, or any format which is not processed by
 'case' starting at line 120.

 It is possible to fix it by adding:

 aiff->block_duration = 1;

 inside 'default' of this 'case'.

 So the code will look like this:
 {{{
         switch (codec->codec_id) {
         case CODEC_ID_PCM_S16BE:
             codec->codec_id =
 aiff_codec_get_id(codec->bits_per_coded_sample);
             codec->bits_per_coded_sample =
 av_get_bits_per_sample(codec->codec_id);
             aiff->block_duration = 1;
             break;
         case CODEC_ID_ADPCM_IMA_QT:
             codec->block_align = 34*codec->channels;
             aiff->block_duration = 64;
             break;
         case CODEC_ID_MACE3:
             codec->block_align = 2*codec->channels;
             aiff->block_duration = 6;
             break;
         case CODEC_ID_MACE6:
             codec->block_align = 1*codec->channels;
             aiff->block_duration = 6;
             break;
         case CODEC_ID_GSM:
             codec->block_align = 33;
             aiff->block_duration = 160;
             break;
         case CODEC_ID_QCELP:
             codec->block_align = 35;
             aiff->block_duration = 160;
             break;
         default:
             aiff->block_duration = 1; //!< avoid Div/0
             break;
         }
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1064>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list