Re: Fix for memory corruption in yuvdeinterlace

"Steven M. Schultz" <[email protected]> Tue, 9 Oct 2007 09:47:51 -0700 (PDT)
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
> 
> On Tue, 9 Oct 2007, Burkhard Plaum wrote:
> 
> > Why don't people use valgrind more often?

	Probably for the same reason they compute negative offsets and
	addresses outside the malloc'd arena.  That's why the mentioned
	"ifdef notnow"

// do NOT do this - the "in0 -w" computes an address 'w' bytes BEFORE the
// start of the buffer

	is present.  

	The buffer management (or rather the address calculation) in 
	yuvdeinterlace has been problematic for a long time.

	What I was seeing was crashes in free() because the incorrect
	address was being passed.  

	It also appears that malloc/free implementations differ a lot.  Others
	(with linux systems) were having no issues with yuvdeinterlace but 
	it was consistently crashing on a OSX system.  

	The program no longer crashes on either platform so the problem, 
	from my perspective, is resolved.  

	Maybe I'll apply the patch and see if it restores the crashing
	behaviour ;)

	It just feels "sloppy" to over allocate the buffers rather than 
	check for the boundary conditions.  Why not allocate the exact 
	size needed and check the address so that it doesn't go outside
	the frame?

	Cheers,
	Steven Schultz


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/