mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
mesa: fix NULL pointer deref bug in _mesa_drawbuffers()
This is a follow-on fix to commit 39b40ad144. Fixes a crash if the
user calls glDrawBuffers(0, NULL).
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82814
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
dfa10ed264
commit
31ce84a81f
1 changed files with 1 additions and 1 deletions
|
|
@ -498,7 +498,7 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
|
|||
* (ex: glDrawBuffer(GL_FRONT_AND_BACK)).
|
||||
* Otherwise, destMask[x] can only have one bit set.
|
||||
*/
|
||||
if (_mesa_bitcount(destMask[0]) > 1) {
|
||||
if (n > 0 && _mesa_bitcount(destMask[0]) > 1) {
|
||||
GLuint count = 0, destMask0 = destMask[0];
|
||||
while (destMask0) {
|
||||
GLint bufIndex = ffs(destMask0) - 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue