mesa: don't crash on incorrect texture use

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4995

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11603>
(cherry picked from commit 328ea8e04a)
This commit is contained in:
Timothy Arceri 2021-06-25 22:33:22 +10:00 committed by Eric Engestrom
parent 6149ccf1f4
commit eb597d2ce1
3 changed files with 7 additions and 2 deletions

View file

@ -508,7 +508,7 @@
"description": "mesa: don't crash on incorrect texture use",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -1913,6 +1913,10 @@ _mesa_prepare_mipmap_levels(struct gl_context *ctx,
{
const struct gl_texture_image *baseImage =
_mesa_select_tex_image(texObj, texObj->Target, baseLevel);
if (baseImage == NULL)
return;
const GLint border = 0;
GLint width = baseImage->Width;
GLint height = baseImage->Height;

View file

@ -2751,7 +2751,8 @@ st_finalize_texture(struct gl_context *ctx,
firstImage = st_texture_image_const(stObj->base.Image[cubeMapFace]
[stObj->base.Attrib.BaseLevel]);
assert(firstImage);
if (!firstImage)
return false;
/* If both firstImage and stObj point to a texture which can contain
* all active images, favour firstImage. Note that because of the