[FFmpeg-cvslog] r13653 - trunk/libavcodec/ac3.c

Justin Ruggles justinruggles
Sat Jun 7 00:27:32 CEST 2008


Michael Niedermayer wrote:
> On Wed, Jun 04, 2008 at 01:34:26AM +0200, jbr wrote:
>> Author: jbr
>> Date: Wed Jun  4 01:34:26 2008
>> New Revision: 13653
>>
>> Log:
>> prevent crash when dba params are invalid
>>
>> Modified:
>>    trunk/libavcodec/ac3.c
>>
>> Modified: trunk/libavcodec/ac3.c
>> ==============================================================================
>> --- trunk/libavcodec/ac3.c	(original)
>> +++ trunk/libavcodec/ac3.c	Wed Jun  4 01:34:26 2008
>> @@ -157,8 +157,8 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAl
>>      if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
>>          int band, seg, delta;
>>          band = 0;
>> -        for (seg = 0; seg < dba_nsegs; seg++) {
>> -            band += dba_offsets[seg];
>> +        for (seg = 0; seg < FFMIN(8, dba_nsegs); seg++) {
>> +            band = FFMIN(49, band + dba_offsets[seg]);
>>              if (dba_values[seg] >= 4) {
> 
> shouldnt that end in a return -1 instead of silently cliping?

Yeah, that probably would be better.  Granted, this would be a very rare
error due to either a bad encoder or a damaged frame making it past the
CRC check, but it's still worth trying to catch.  Right now none of the
bit allocation functions return an error code, but I'll change that.

Thanks,
Justin




More information about the ffmpeg-cvslog mailing list