Bug 31934 - [gallium] Mapping empty buffer object causes SIGSEGV
[gallium] Mapping empty buffer object causes SIGSEGV
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: Mesa core
git
x86-64 (AMD64) Linux (All)
: medium normal
Assigned To: mesa-dev
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-26 04:54 UTC by Wiktor Janas
Modified: 2010-11-26 12:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wiktor Janas 2010-11-26 04:54:24 UTC
The following code triggers SIGSEGV at mesa/state_tracker/st_cb_bufferobjects.c:236, because st_obj->buffer is NULL.

#include <stdlib.h>

#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glut.h>

int main (int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA);
    glutInitWindowSize(512,512);
    glutCreateWindow("");

    GLuint id;
    glGenBuffersARB(1, &id);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, id);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, 0, NULL, GL_STATIC_DRAW);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);

    glBindBufferARB(GL_ARRAY_BUFFER_ARB, id);
    glMapBuffer(GL_ARRAY_BUFFER_ARB, GL_READ_WRITE_ARB); /* CRASH! */
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);

    return 0;
}
Comment 1 Brian Paul 2010-11-26 12:50:36 UTC
Fixed with commit 97ae4dad1cc24c5e969e6b99f07ece68e239964b.
Committed to the 7.9 branch too.  Thanks for the test program!