[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c
Zuxy Meng
zuxy.meng
Sun Aug 12 06:39:11 CEST 2007
Hi,
2007/8/12, Ramiro Ribeiro Polla <ramiro at lisha.ufsc.br>:
> 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.
Does it hurt if we remove ff_check_alignment() from within dsputil_init()?
>
> Updated patch attached.
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
More information about the ffmpeg-devel
mailing list