diff options
author | Brian Paul <brianp@vmware.com> | 2009-04-22 18:16:03 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-04-22 18:18:29 +0100 |
commit | fa92756400ccfbb3f0201df634feb45ab4f98352 (patch) | |
tree | 76d6a1b1b85ca2798acc58ed4b75bf51e080809f | |
parent | 50853be894aa3edd1e9271f7d625f319209e340f (diff) |
mesa: Fix buffer overflow when parsing generic vertex attributes.
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index b47bf360cf..c7a031067e 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1513,10 +1513,16 @@ generic_attrib_check(struct var_cache *vc_head) curr = vc_head; while (curr) { if (curr->type == vt_attrib) { - if (curr->attrib_is_generic) - genericAttrib[ curr->attrib_binding ] = GL_TRUE; - else + if (curr->attrib_is_generic) { + GLuint attr = (curr->attrib_binding == 0) + ? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0); + assert(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + genericAttrib[attr] = GL_TRUE; + } + else { + assert(curr->attrib_binding < MAX_VERTEX_PROGRAM_ATTRIBS); explicitAttrib[ curr->attrib_binding ] = GL_TRUE; + } } curr = curr->next; |