[Mesa-dev] [PATCH] nir/i965: assert first is always less than 64

Kenneth Graunke kenneth at whitecape.org
Sat Jan 14 07:15:20 UTC 2017


On Thursday, January 12, 2017 12:24:41 PM PST Juan A. Suarez Romero wrote:
> This fixes a defect detected by Coverity Scan.
> ---
>  src/mesa/drivers/dri/i965/brw_draw_upload.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
> index b7527f2cd9..abf3859614 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
> @@ -482,6 +482,7 @@ brw_prepare_vertices(struct brw_context *brw)
>     brw->vb.nr_enabled = 0;
>     while (vs_inputs) {
>        GLuint first = ffsll(vs_inputs) - 1;
> +      assert (first < 64);
>        GLuint index =
>           first - DIV_ROUND_UP(_mesa_bitcount_64(vs_prog_data->double_inputs_read &
>                                                  BITFIELD64_MASK(first)), 2);
> 

FWIW, I believe the actual bound is (first <= VERT_ATTRIB_MAX + 1).

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170113/89b98969/attachment.sig>


More information about the mesa-dev mailing list