Mesa (master): mesa/main: In register_surface() verify gl_texture_object was found

Ville Syrjala vsyrjala at kemper.freedesktop.org
Thu Jun 26 12:47:13 UTC 2014


Module: Mesa
Branch: master
Commit: 0f7958aac29ce976d6fba7d87ae40c1b8d448bbc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f7958aac29ce976d6fba7d87ae40c1b8d448bbc

Author: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Date:   Thu May  8 11:16:54 2014 +0300

mesa/main: In register_surface() verify gl_texture_object was found

Verify _mesa_lookup_texture() returned valid pointer before using it.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/vdpau.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c
index f1b3ece..975b812 100644
--- a/src/mesa/main/vdpau.c
+++ b/src/mesa/main/vdpau.c
@@ -145,6 +145,12 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
    for (i = 0; i < numTextureNames; ++i) {
       struct gl_texture_object *tex;
       tex  = _mesa_lookup_texture(ctx, textureNames[i]);
+      if (tex == NULL) {
+         free(surf);
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "VDPAURegisterSurfaceNV(texture ID not found)");
+         return (GLintptr)NULL;
+      }
 
       _mesa_lock_texture(ctx, tex);
 




More information about the mesa-commit mailing list