From b29b852fdb66437b4a32a8e0d79130e320ee7885 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Tue, 15 Feb 2011 17:46:42 -0800 Subject: [PATCH] Check for null pointer in mipmap image data If caller passes in an improperly initialized mipmap, it can lead to a null pointer dereference. Add a check and error message for this condition prior to the dereferencing. FDO bugs #32246, #32096 Ref. https://bugs.launchpad.net/mesa/+bug/710108 Signed-off-by: Bryce Harrington --- src/mesa/main/mipmap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index e073e17..01d0132 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1817,6 +1817,11 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target, else { srcData = (const GLubyte *) srcImage->Data; dstData = (GLubyte *) dstImage->Data; + + if (!srcData) { + _mesa_problem(ctx, "undefined srcImage->Data in _mesa_generate_mipmaps"); + return; + } } ASSERT(dstImage->TexFormat); -- 1.7.2.3