mesa/main: In register_surface() verify gl_texture_object was found
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Thu, 8 May 2014 08:16:54 +0000 (11:16 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 26 Jun 2014 12:37:14 +0000 (15:37 +0300)
Verify _mesa_lookup_texture() returned valid pointer before using it.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/vdpau.c

index f1b3eceee3166ce40045df530822b861873d92eb..975b812cda5f95ccb2766a966af4ec308900b0e8 100644 (file)
@@ -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);