[MPlayer-cvslog] r29425 - in trunk: libass/ass_render.c libmpcodecs/vf_ass.c

eugeni subversion at mplayerhq.hu
Sat Jul 18 13:33:03 CEST 2009


Author: eugeni
Date: Sat Jul 18 13:33:03 2009
New Revision: 29425

Log:
Make sure clip coordinates are inside the screen area.

Modified:
   trunk/libass/ass_render.c
   trunk/libmpcodecs/vf_ass.c

Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	Sat Jul 18 13:33:00 2009	(r29424)
+++ trunk/libass/ass_render.c	Sat Jul 18 13:33:03 2009	(r29425)
@@ -317,6 +317,11 @@ static ass_image_t* my_draw_bitmap(unsig
 {
 	ass_image_t* img = calloc(1, sizeof(ass_image_t));
 
+	assert(dst_x >= 0);
+	assert(dst_y >= 0);
+	assert(dst_x + bitmap_w < frame_context.width);
+	assert(dst_y + bitmap_h < frame_context.height);
+
 	img->w = bitmap_w;
 	img->h = bitmap_h;
 	img->stride = stride;
@@ -598,6 +603,7 @@ static double x2scr_pos(double x) {
 	return x*frame_context.orig_width / frame_context.track->PlayResX +
 		global_settings->left_margin;
 }
+
 /**
  * \brief Mapping between script and screen coordinates
  */
@@ -2148,6 +2154,11 @@ static int ass_render_event(ass_event_t*
 		render_context.clip_y1 = y2scr_pos(render_context.clip_y1);
 	}
 
+	render_context.clip_x0 = FFMIN(FFMAX(render_context.clip_x0, 0), frame_context.width);
+	render_context.clip_x1 = FFMIN(FFMAX(render_context.clip_x1, 0), frame_context.width);
+	render_context.clip_y0 = FFMIN(FFMAX(render_context.clip_y0, 0), frame_context.height);
+	render_context.clip_y1 = FFMIN(FFMAX(render_context.clip_y1, 0), frame_context.height);
+
 	// calculate rotation parameters
 	{
 		FT_Vector center;

Modified: trunk/libmpcodecs/vf_ass.c
==============================================================================
--- trunk/libmpcodecs/vf_ass.c	Sat Jul 18 13:33:00 2009	(r29424)
+++ trunk/libmpcodecs/vf_ass.c	Sat Jul 18 13:33:03 2009	(r29425)
@@ -219,6 +219,10 @@ static void copy_from_image(struct vf_in
 	last_row += (last_row % 2);
 	chroma_rows = (last_row - first_row) / 2;
 
+	assert(first_row >= 0);
+	assert(first_row <= last_row);
+	assert(last_row < vf->priv->outh);
+
 	for (pl = 1; pl < 3; ++pl) {
 		int dst_stride = vf->priv->outw;
 		int src_stride = vf->dmpi->stride[pl];


More information about the MPlayer-cvslog mailing list