mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
mask color indexes against palette size, per the spec
This commit is contained in:
parent
0fdb7ef877
commit
cbc527cd17
1 changed files with 5 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.1
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
@ -1023,9 +1023,9 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
|
|||
GLint i, GLint j, GLint k, GLchan *texel )
|
||||
{
|
||||
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
|
||||
const GLuint index = *src;
|
||||
const struct gl_color_table *palette;
|
||||
const GLchan *table;
|
||||
GLuint index;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (ctx->Texture.SharedPalette) {
|
||||
|
|
@ -1039,6 +1039,9 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
|
|||
ASSERT(palette->Type != GL_FLOAT);
|
||||
table = (const GLchan *) palette->Table;
|
||||
|
||||
/* Mask the index against size of palette to avoid going out of bounds */
|
||||
index = (*src) & (palette->Size - 1);
|
||||
|
||||
switch (palette->Format) {
|
||||
case GL_ALPHA:
|
||||
texel[RCOMP] =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue