Mesa (main): mesa: don't crash on incorrect texture use
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 29 02:04:42 UTC 2021
Module: Mesa
Branch: main
Commit: 328ea8e04accfa4e156c37959714f5bc92cb0421
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=328ea8e04accfa4e156c37959714f5bc92cb0421
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Fri Jun 25 22:33:22 2021 +1000
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 at amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11603>
---
src/mesa/main/mipmap.c | 4 ++++
src/mesa/state_tracker/st_cb_texture.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 8f08396fe15..b73413ee51f 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -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;
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a40e0f88ce3..8bf3603e4ae 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2757,7 +2757,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
More information about the mesa-commit
mailing list