[Mesa-dev] [PATCH 2/2] draw: fix overflows in the indexed rendering paths

Zack Rusin zackr at vmware.com
Wed Jul 3 13:33:20 PDT 2013


----- Original Message -----
> The code looks good AFAICT.  Just a few style nits below.
> 
> For both:  Reviewed-by: Brian Paul <brianp at vmware.com>

Thanks a lot for the review.


> >   #define DRAW_GET_IDX(_elts, _i)                   \
> > -   (((_i) >= draw->pt.user.eltMax) ? 0 : (_elts)[_i])
> > +   (((_i) >= draw->pt.user.eltMax) ? 0xffffffff : (_elts)[_i])
> 
> replace 0xffffffff with MAX_ELT_IDX?

Would you be ok with replacing all of those with UINT_MAX? Otherwise this one should really be MAX_INDEX_BUFFER_IDX (maximum index in the index buffer), the next one MAX_LOOP_IDX (max representable loop index), the following one MAX_FETCH_IDX (max index of a vertex to fetch, which is what the MAX_ELT_IDX currently represents), or we could call them all what they really are which is maximum unsigned's or UINT_MAX.

z


More information about the mesa-dev mailing list