diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-03-15 21:13:13 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-03-15 21:13:13 +0000 |
commit | 33f64f9e05aa9b8fab33208af07b3a04a014b109 (patch) | |
tree | abda9e315a06c33d7a2c3f7c48569ea0ed22a5c9 /libvo | |
parent | 122744d6ed5791c1afe8bf0e76f22c2c51d09f4f (diff) | |
download | mpv-33f64f9e05aa9b8fab33208af07b3a04a014b109.tar.bz2 mpv-33f64f9e05aa9b8fab33208af07b3a04a014b109.tar.xz |
extra checks on size of OSD parts (though IMHO these values should never be bad)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17876 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_gl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index e0d79bd98d..1bd8e1ef9f 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -436,6 +436,11 @@ static void create_osd_texture(int x0, int y0, int w, int h, // 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 @@ static void create_osd_texture(int x0, int y0, int w, int h, 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); |