[Mesa-dev] [PATCH] st/mesa: check for missing VBO in setup_interleaved_attribs()

Brian Paul brianp at vmware.com
Mon Nov 14 07:29:09 PST 2011


This fixes a crash with the piglit vbo-too-small test.
---
 src/mesa/state_tracker/st_draw.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index f2fbf48..cb518e1 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -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;
          }
 
-- 
1.7.3.4



More information about the mesa-dev mailing list