Bug 6656

Summary: arbvptest3 segfaults because of bad index to tnl->vtx.tabfv
Product: Mesa Reporter: Tilman Sauerbeck <tilman>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high Keywords: patch
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Don't add VERT_ATTRIB_GENERIC0 to the indices

Description Tilman Sauerbeck 2006-04-19 22:28:22 UTC
0x00000000 in ?? ()
(gdb) f 1
#1  0xb7960627 in _tnl_VertexAttrib3fARB (index=19, x=1, y=0.5, z=0.25)
    at tnl/t_vtx_generic.c:472
472	   tnl->vtx.tabfv[index][3-1]( &z );
(gdb) p index
$1 = 19

_tnl_VertexAttrib3fARB (and other functions in t_vtx_generic.) have the
following code snippet:

   if (index >= MAX_VERTEX_ATTRIBS)
      index = ERROR_ATTRIB;
   else
      index += VERT_ATTRIB_GENERIC0;

MAX_VERTEX_ATTRIBS == VERT_ATTRIB_GENERIC0 == 16, and tabfv only has 17 slots,
so this doesn't make sense.

The segfault happened with the r300 driver, but it doesn't seem to be driver
specific.
Comment 1 Tilman Sauerbeck 2006-04-19 22:30:04 UTC
Created attachment 5376 [details] [review]
Don't add VERT_ATTRIB_GENERIC0 to the indices

I'm guessing the fix doesn't need to be applied to _tnl_VertexAttrib3fARB only.
Comment 2 Brian Paul 2006-04-20 00:50:11 UTC
We're kind of mid-way through some vertex attrib changes.  Previously the
generic vertex attribs aliased the conventional attribs.  With OpenGL 2.0,
however, the generic attribs are separate from the conventional attribs (no
aliasing).  I'll have to examine some other code before making these changes.
Comment 3 Tilman Sauerbeck 2006-04-29 05:31:43 UTC
Works for me now.
Comment 4 Adam Jackson 2009-08-24 12:23:48 UTC
Mass version move, cvs -> git

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.