Mesa (master): mesa: fix crash in find_value

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 21 07:37:29 UTC 2020


Module: Mesa
Branch: master
Commit: dbfeec62c3852293d5f029db73ff7d63ff0f14e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbfeec62c3852293d5f029db73ff7d63ff0f14e5

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Tue Apr  7 09:42:39 2020 +0200

mesa: fix crash in find_value

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4584>

---

 src/mesa/main/get.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 7e9767d95e1..48f43cb55f3 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1619,8 +1619,12 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
       if (ctx->Texture.CurrentUnit < ARRAY_SIZE(ctx->Texture.FixedFuncUnit)) {
          unsigned index = ctx->Texture.CurrentUnit;
          *p = ((char *)&ctx->Texture.FixedFuncUnit[index] + d->offset);
+         return d;
       }
-      return d;
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=%s,unit=%d)", func,
+                  _mesa_enum_to_string(pname),
+                  ctx->Texture.CurrentUnit);
+      return &error_value;
    case LOC_CUSTOM:
       find_custom_value(ctx, d, v);
       *p = v;



More information about the mesa-commit mailing list