# HG changeset patch # User reimar # Date 1142457193 0 # Node ID 3bf1095091893b3a1e79a66ae1f8619aefb11bdc # Parent 1973600f8f3e9a6c0cba78700b3531ef5baea988 extra checks on size of OSD parts (though IMHO these values should never be bad) diff -r 1973600f8f3e -r 3bf109509189 libvo/vo_gl.c --- a/libvo/vo_gl.c Wed Mar 15 17:16:13 2006 +0000 +++ b/libvo/vo_gl.c Wed Mar 15 21:13:13 2006 +0000 @@ -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);