comparison vorbis.c @ 3270:d6a5ed01acdf libavcodec

Vorbis specs requires blocksize_1 >= blocksize_0, error if it's false. Predict buffer size from blocksize_1 and number of channels and make sure this does not exceed AVCODEC_MAX_AUDIO_FRAME_SIZE Patch by Uoti Urpala >>> uoti |.| urpala |@| pp1 |.| inet |.| fi <<<
author rtognimp
date Sun, 23 Apr 2006 21:11:31 +0000
parents ede5c3c0a0eb
children 539af98972f4
comparison
equal deleted inserted replaced
3269:c925a46f7594 3270:d6a5ed01acdf
870 vc->bitrate_minimum=get_bits_long_le(gb, 32); 870 vc->bitrate_minimum=get_bits_long_le(gb, 32);
871 bl0=get_bits(gb, 4); 871 bl0=get_bits(gb, 4);
872 bl1=get_bits(gb, 4); 872 bl1=get_bits(gb, 4);
873 vc->blocksize_0=(1<<bl0); 873 vc->blocksize_0=(1<<bl0);
874 vc->blocksize_1=(1<<bl1); 874 vc->blocksize_1=(1<<bl1);
875 if (bl0>13 || bl0<6 || bl1>13 || bl1<6) { 875 if (bl0>13 || bl0<6 || bl1>13 || bl1<6 || bl1<bl0) {
876 av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (illegal blocksize). \n"); 876 av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (illegal blocksize). \n");
877 return 3; 877 return 3;
878 }
879 // output format int16
880 if (vc->blocksize_1/2 * vc->audio_channels * 2 >
881 AVCODEC_MAX_AUDIO_FRAME_SIZE) {
882 av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis channel count makes "
883 "output packets too large.\n");
884 return 4;
878 } 885 }
879 vc->swin=vwin[bl0-6]; 886 vc->swin=vwin[bl0-6];
880 vc->lwin=vwin[bl1-6]; 887 vc->lwin=vwin[bl1-6];
881 888
882 if ((get_bits1(gb)) == 0) { 889 if ((get_bits1(gb)) == 0) {