Bug 26121 - Crash on x86-64 (but not on x86) for glLightfv w/o rendering context
Summary: Crash on x86-64 (but not on x86) for glLightfv w/o rendering context
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-19 08:08 UTC by Tobias Burnus
Modified: 2010-02-19 11:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Tobias Burnus 2010-01-19 08:08:25 UTC
The problem was encountered using XCrySDen (http://www.xcrysden.org/) and appears with both mesa-libGL-devel-6.5.1-9.fc6 and Mesa-7.7-5.3.x86_64 on Linux.

The problem is that calling glLightfv without a rendering context crashes in libGL x86-64 - while libGL x86 (i686) works. There seems to be a NULL pointer check missing.

While the application should have a rendering context (I will report a bug), it probably makes still sense to add a NULL check in Mesa.


$ cat test.c
#include <GL/gl.h>

int main ()
{
GLfloat ambient[4] = {0.2, 0.2, 0.2, 1.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
return 0;
}

$ gcc test.c -lGL && ./a.out
Segmentation fault
$ gcc -m32 test.c -lGL && ./a.out
$

See also:
http://sourceforge.net/mailarchive/message.php?msg_name=4B559729.3000509%40net-b.de
http://sourceforge.net/mailarchive/message.php?msg_name=4B55D3B5.9010506%40vmware.com
Comment 1 Tobias Burnus 2010-01-19 08:41:36 UTC
Cross-ref to the application (xcrysden) bug report:
http://www.democritos.it/pipermail/xcrysden/2010-January/000732.html
Comment 2 Ian Romanick 2010-02-19 11:40:05 UTC
The NULL dereference happens during function dispatch.  Add a NULL check would add overhead to every single OpenGL function call.  Correct applications should not have to pay a performance penalty to prevent buggy apps from crashing.


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.