From: Adam Jackson Date: Sun, 2 Apr 2006 23:51:30 +0000 (+0000) Subject: Coverity #476: Avoid walking off the end of ->vtx.attrsz, it's declared to X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=05ddc4a6c59f4bd288d322594afe4ac561d07fa7;p=mesa.git Coverity #476: Avoid walking off the end of ->vtx.attrsz, it's declared to be _TNL_ATTRIB_MAX long so that's not a valid index (woo zero based indexing). This code still looks wrong though, the asymmetry between _tnl_copy_to_current and _tnl_copy_from_current has me worried. --- diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index d52d2f7a471..14a7ab0c0c8 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -194,7 +194,7 @@ static void _tnl_copy_from_current( GLcontext *ctx ) tnl->vtx.CurrentFloatEdgeFlag = (GLfloat)ctx->Current.EdgeFlag; - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_MAX ; i++) + for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_MAX ; i++) switch (tnl->vtx.attrsz[i]) { case 4: tnl->vtx.attrptr[i][3] = tnl->vtx.current[i][3]; case 3: tnl->vtx.attrptr[i][2] = tnl->vtx.current[i][2];