[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c

Ramiro Ribeiro Polla ramiro
Sun Aug 12 03:19:18 CEST 2007


Uoti Urpala wrote:
> On Sat, 2007-08-11 at 20:14 -0300, Ramiro Polla wrote:
>   
>> Michael Niedermayer wrote:
>>     
>>>> -int ff_check_alignment(void){
>>>> +int attribute_align_arg ff_check_alignment(void){
>>>>      static int did_fail=0;
>>>>      DECLARE_ALIGNED_16(int, aligned);
>>>>         
>
>   
>>> this IS wrong, it defeats the purpose of the function which is to check that
>>> the stack of the caller is properly aligned
>>>       
>
>   
>> Well, if attribute_align_arg isn't added to this function, it will still 
>> print out the terrorizing message but it won't ever crash due to 
>> misalignment.
>>     
>
> Why does it print the message then? And if the stack is misaligned at
> that point (unless realigned when entering the function) why does it not
> crash? Are there some call paths "from outside" which end up calling
> this check without aligning the stack but do not call any code which
> would absolutely need alignment?
>   

Indeed, you are right. I was under the impression dsputil_init() could 
be called from the user app, since it is not defined static, nor with an 
ff_ prefix.

Updated patch attached.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: align_arg_5.diff
Type: text/x-patch
Size: 3674 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070811/134f75f0/attachment.bin>



More information about the ffmpeg-devel mailing list