From: Juha-Pekka Heikkila Date: Thu, 8 May 2014 08:16:54 +0000 (+0300) Subject: mesa/main: In register_surface() verify gl_texture_object was found X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f7958aac29ce976d6fba7d87ae40c1b8d448bbc;p=mesa.git 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 Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index f1b3eceee31..975b812cda5 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);