st/mesa: check for missing VBO in setup_interleaved_attribs()
authorBrian Paul <brianp@vmware.com>
Mon, 14 Nov 2011 15:27:13 +0000 (08:27 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 15 Nov 2011 14:49:26 +0000 (07:49 -0700)
This fixes a crash with the piglit vbo-too-small test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/mesa/state_tracker/st_draw.c

index f2fbf483694dc5d0630290b805980c6734f52d74..cb518e1afb3ebcb90a45bf7cbc0695cf0bed1d61 100644 (file)
@@ -436,8 +436,8 @@ setup_interleaved_attribs(struct gl_context *ctx,
       /* all interleaved arrays in a VBO */
       struct st_buffer_object *stobj = st_buffer_object(bufobj);
 
-      if (!stobj) {
-         /* probably out of memory */
+      if (!stobj || !stobj->buffer) {
+         /* probably out of memory (or zero-sized buffer) */
          return GL_FALSE;
       }
 
@@ -505,7 +505,7 @@ setup_non_interleaved_attribs(struct gl_context *ctx,
          struct st_buffer_object *stobj = st_buffer_object(bufobj);
 
          if (!stobj || !stobj->buffer) {
-            /* probably ran out of memory */
+            /* probably out of memory (or zero-sized buffer) */
             return GL_FALSE;
          }