[FFmpeg-devel] Broken compile with latest libavutil/common.h

Måns Rullgård mans
Thu Jan 15 15:37:56 CET 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Thu, Jan 15, 2009 at 12:43:27AM +0000, M?ns Rullg?rd wrote:
>> Aurelien Jacobs <aurel at gnuage.org> writes:
>> > +/**
>> > + * converts fourcc string to int
>> > + */
>> > +static inline av_pure int ff_get_fourcc(const char *s){
>> > +    assert( strlen(s)==4 );
>> > +    return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24);
>> > +}
>> 
>> This looks a lot like AV_RL32().  
>
> indeed and i wouldnt mind seeing all ff_get_fourcc replaced by it
>
>> BTW, assert(strlen(s) ... ) is a
>> stupid idea.  If there's bad data, what's to say there will be a null
>> terminator anywhere close?
>
> nothing, but if its not it will either segfault by reading to much
> or the assert will end the program thus i dont see it as a problem.

What if it doesn't hit unreadable memory, but hits a memory-mapped
device where reads have side-effects?

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list