Mesa (staging/19.3): mesa: Prevent _MaxLevel from being less than zero

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 9 18:53:41 UTC 2020


Module: Mesa
Branch: staging/19.3
Commit: 133e3245e7c477c9bd6121b47fba16ad5cd12fca
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=133e3245e7c477c9bd6121b47fba16ad5cd12fca

Author: Thong Thai <thong.thai at amd.com>
Date:   Tue Jan  7 16:38:25 2020 -0500

mesa: Prevent _MaxLevel from being less than zero

When decoding using VDPAU, the _MaxLevel value becomes -1 due to
NumLevels being equal to 0 at a certain point, and decoding fails
due to an assertion later on.

Signed-off-by: Thong Thai <thong.thai at amd.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>
Cc: 19.2 19.3 <mesa-stable at lists.freedesktop.org>
(cherry picked from commit 3a4f8c8158df304af08681edbbfdfd40e43a6829)

---

 src/mesa/main/texobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 0f124459f75..c5459f4540f 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -757,7 +757,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
       /* Adjust max level for views: the data store may have more levels than
        * the view exposes.
        */
-      t->_MaxLevel = MIN2(t->_MaxLevel, t->NumLevels - 1);
+      t->_MaxLevel = MAX2(MIN2(t->_MaxLevel, t->NumLevels - 1), 0);
    }
 
    /* Compute _MaxLambda = q - p in the spec used during mipmapping */




More information about the mesa-commit mailing list