YaGL: validate glCopyTexImage2d() parameters
authorIgor Mitsyanko <i.mitsyanko@samsung.com>
Thu, 20 Dec 2012 16:18:57 +0000 (20:18 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Mon, 15 Apr 2013 11:24:18 +0000 (15:24 +0400)
Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
hw/yagl_apis/gles/yagl_host_gles_calls.c

index 9731cafbfa33ab2040bbad6ecf831a6073ce689e..e2691fb620d8d79044f905dea13b32f9097fd223 100644 (file)
@@ -522,6 +522,17 @@ bool yagl_host_glCopyTexImage2D(GLenum target,
 {
     YAGL_GET_CTX(glCopyTexImage2D);
 
+    if (ctx->base.client_api == yagl_client_api_gles1 &&
+        target != GL_TEXTURE_2D) {
+        YAGL_SET_ERR(GL_INVALID_ENUM);
+        return true;
+    }
+
+    if (border != 0) {
+        YAGL_SET_ERR(GL_INVALID_VALUE);
+        return true;
+    }
+
     ctx->driver->CopyTexImage2D(target,
                                 level,
                                 internalformat,
@@ -545,6 +556,12 @@ bool yagl_host_glCopyTexSubImage2D(GLenum target,
 {
     YAGL_GET_CTX(glCopyTexSubImage2D);
 
+    if (ctx->base.client_api == yagl_client_api_gles1 &&
+        target != GL_TEXTURE_2D) {
+        YAGL_SET_ERR(GL_INVALID_ENUM);
+        return true;
+    }
+
     ctx->driver->CopyTexSubImage2D(target,
                                    level,
                                    xoffset,