[FFmpeg-cvslog] r11546 - in trunk: libavcodec/gif.c libavformat/gif.c

Mike Melanson mike
Thu Jan 17 03:49:43 CET 2008


Rich Felker wrote:
> On Thu, Jan 17, 2008 at 01:12:05AM +0100, michael wrote:
>> Author: michael
>> Date: Thu Jan 17 01:12:04 2008
>> New Revision: 11546
>>
>> Log:
>> Replace idiotic (what moron wrote that code?) "buffer overflow" message by
>> abort()
>>
>>
>> Modified:
>>    trunk/libavcodec/gif.c
>>    trunk/libavformat/gif.c
>>
>> Modified: trunk/libavcodec/gif.c
>> ==============================================================================
>> --- trunk/libavcodec/gif.c	(original)
>> +++ trunk/libavcodec/gif.c	Thu Jan 17 01:12:04 2008
>> @@ -136,7 +136,7 @@ static void gif_put_bits_rev(PutBitConte
>>  
>>          //printf("bitbuf = %08x\n", bit_buf);
>>          if (s->buf_ptr >= s->buf_end)
>> -            puts("bit buffer overflow !!"); // should never happen ! who got rid of the callback ???
>> +            abort();
> 
> If it can't happen, change it to assert(s->buf_ptr < s->buf_end).
> If it can happen, it needs to be handled. abort() is not a way of
> handling it.

Sure enough. I was about to demand to know how this change got approved
until I noticed that Michael submitted it himself. :) I think the more
traditional solution (at least, the one that I used in many decoders) is
to return early from the current function if the decode can not proceed
further.

-- 
	-Mike Melanson




More information about the ffmpeg-cvslog mailing list