Bug 31934 - [gallium] Mapping empty buffer object causes SIGSEGV
Summary: [gallium] Mapping empty buffer object causes SIGSEGV
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-26 04:54 UTC by Wiktor Janas
Modified: 2010-11-26 12:50 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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!


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.