diff options
author | Matt Turner <[email protected]> | 2015-06-22 11:20:32 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2015-06-23 12:24:42 -0700 |
commit | d8eeb4917ca39a0698731f64933c85a7c44e9247 (patch) | |
tree | cdaa7e6a1952e5ae0bb98c36258c099bffa90900 /src/mesa | |
parent | 4d93a07c45c8aa4cb3adbfcb9d61dcb54d8c404f (diff) |
i965: Assert that the GL primitive isn't out of range.
Coverity sees the if (mode >= BRW_PRIM_OFFSET (128)) test and assumes
that the else-branch might execute for mode to up 127, which out be out
of bounds.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index a7164dbf7d8..b91597a9f5d 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -92,8 +92,10 @@ get_hw_prim_for_gl_prim(int mode) { if (mode >= BRW_PRIM_OFFSET) return mode - BRW_PRIM_OFFSET; - else + else { + assert(mode < ARRAY_SIZE(prim_to_hw_prim)); return prim_to_hw_prim[mode]; + } } |