[MPlayer-cvslog] CVS: main/libvo vo_gl.c,1.115,1.116

Reimar Döffinger CVS syncmail at mplayerhq.hu
Wed Mar 15 22:13:16 CET 2006


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv27333

Modified Files:
	vo_gl.c 
Log Message:
extra checks on size of OSD parts (though IMHO these values should never be bad)


Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- vo_gl.c	15 Mar 2006 12:15:35 -0000	1.115
+++ vo_gl.c	15 Mar 2006 21:13:13 -0000	1.116
@@ -436,6 +436,11 @@
   // initialize to 8 to avoid special-casing on alignment
   int sx = 8, sy = 8;
   GLint scale_type = (scaled_osd) ? GL_LINEAR : GL_NEAREST;
+
+  if (w <= 0 || h <= 0 || stride < w) {
+    mp_msg(MSGT_VO, MSGL_V, "Invalid dimensions OSD for part!\n");
+    return;
+  }
   texSize(w, h, &sx, &sy);
 
   if (osdtexCnt >= MAX_OSD_PARTS) {
@@ -459,7 +464,7 @@
   char *tmp = (char *)malloc(stride * h);
   // convert alpha from weird MPlayer scale.
   // in-place is not possible since it is reused for future OSDs
-  for (i = h * stride - 1; i; i--)
+  for (i = h * stride - 1; i > 0; i--)
     tmp[i] = srca[i] - 1;
   glUploadTex(gl_target, GL_ALPHA, GL_UNSIGNED_BYTE, tmp, stride,
               0, 0, w, h, 0);




More information about the MPlayer-cvslog mailing list