[Ffmpeg-devel] [PATCH] have cs_test check for sigsegv at smaller widths and sigill

Ivo ivop
Fri Apr 13 19:19:26 CEST 2007


On Friday 13 April 2007 17:24, Reimar D?ffinger wrote:
> Hello,
>
> On Fri, Apr 13, 2007 at 05:10:00PM +0200, Ivo wrote:
> > Index: libswscale/rgb2rgb_template.c
> > ===================================================================
> > --- libswscale/rgb2rgb_template.c	(revision 22984)
> > +++ libswscale/rgb2rgb_template.c	(working copy)
> > @@ -1367,6 +1367,8 @@
> >  #ifdef HAVE_MMX
> >  /* TODO: unroll this loop */
> >  	asm volatile (
> > +		"cmp $0, %2			\n\t"
> > +		"ja 2f				\n\t"
> >  		"xor %%"REG_a", %%"REG_a"	\n\t"
> >  		ASMALIGN(4)
> >  		"1:				\n\t"
> > @@ -1385,6 +1387,7 @@
> >  		"add $8, %%"REG_a"		\n\t"
> >  		"cmp %2, %%"REG_a"		\n\t"
> >  		" jb 1b				\n\t"
> > +		"2:				\n\t"
>
> Might be nicer to the branch prediction to jump unconditionally to the
> existing cmp after the xor.

It's even worse. The change for rgb32tobgr32 is not ok as it doesn't have 
any fallback C code if the HAVE_MMX block is compiled. So, with my change, 
there will be no conversion done if the incoming image is too small (1 
pixel wide :) ). I'll brew up another patch that rewrites the whole 
function from scratch and also fix two other scalers (rgb32to16 and 
rgb32to15) that do not segfault, but do run the MMX code even if src_size 
is smaller than the size of the units it processes.

--Ivo




More information about the ffmpeg-devel mailing list