Re: Fix for memory corruption in yuvdeinterlace

Burkhard Plaum <[email protected]> Tue, 09 Oct 2007 18:35:55 +0200
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
Hi,

Andreas Bombe schrieb:
> In initialize_memory() the buffer sizes are increased by 2 *
> vertical_overshot_luma / _chroma and then the allocation goes like
> 
>   inframe[0] = (uint8_t *) malloc (luma_size + vertical_overshot_luma);
> 
> ... adding third vertical_overshot to the precomputed size, then however
> these pointers are used without adjusting for overshot.  So I'm sure the
> actual intention was something like
> 
>   inframe[0] = (uint8_t *) malloc (luma_size) + vertical_overshot_luma;
> 
> and when freeing in the deconstructor
> 
>   free (inframe[0] - vertical_overshot_luma);

Didn't look at the patch, but the above is definitely right.
I had the same crashes when porting yuvdeinterlace.cc to gmerlin.

Why don't people use valgrind more often?

Burkhard

-------------------------------------------------------------------------
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/