Mesa (master): intel/decoder: Fix is_header_field starting condition.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Apr 17 06:05:01 UTC 2017


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Apr 12 09:53:44 2017 -0700

intel/decoder: Fix is_header_field starting condition.

Starting positions >= 32 are not part of the header, rather than >.

Caught by Coverity, which found that "bits <<= field->start" may shift
by 32, which has undefined behavior.

CID: 1404968

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

---

 src/intel/common/gen_decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 03c9c7f8d4..e3327d3854 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -849,7 +849,7 @@ is_header_field(struct gen_group *group, struct gen_field *field)
 {
    uint32_t bits;
 
-   if (field->start > 32)
+   if (field->start >= 32)
       return false;
 
    bits = (1U << (field->end - field->start + 1)) - 1;




More information about the mesa-commit mailing list