[FFmpeg-devel] [PATCH] make sure blending the subtitle does not write outside buffer

Reimar Döffinger Reimar.Doeffinger
Wed Aug 8 15:50:22 CEST 2007


Hello,
On Sun, Aug 05, 2007 at 12:12:26PM +0200, Michael Niedermayer wrote:
> On Sun, Aug 05, 2007 at 11:00:04AM +0200, Reimar D?ffinger wrote:
> > attached patch fixes the subtitle rectangles so they do not lie outside
> > the video, which can cause crashes.
> 
> hmm, this seems like a hack to me
> shouldnt blend_subrect "skip" the parts of a rectange which are outside
> of the image?
> 
> that said blend_subrect() needs a cleanup, theres no need to have 9 cases
> handled like that, a generic and a fast one for the middle would do

Does something like this look okay? I can of course split it into two
parts, on that makes sure we do not get outside the bounds of the
destination image and one that "scales" the x and y positions, but then
someone absolutely must suggest a better name for "scaledx/y/w/h" ;-)
Btw. the picture blend_subrect creates when x, y or x+w or y+h is odd is
still completely broken, IMO we should remove the "if (rect->x & 1) {"
etc. cases and just do x &= ~1; w &= ~1; etc.

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list