mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
OpenGL2: Add null dereference checks to DDS loader.
This commit is contained in:
parent
f965f3c66e
commit
f78d04eba8
1 changed files with 11 additions and 6 deletions
|
@ -292,13 +292,18 @@ void R_LoadDDS ( const char *filename, byte **pic, int *width, int *height, GLen
|
|||
len -= 4 + sizeof(*ddsHeader);
|
||||
}
|
||||
|
||||
*width = ddsHeader->width;
|
||||
*height = ddsHeader->height;
|
||||
if (width)
|
||||
*width = ddsHeader->width;
|
||||
if (height)
|
||||
*height = ddsHeader->height;
|
||||
|
||||
if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
|
||||
*numMips = ddsHeader->numMips;
|
||||
else
|
||||
*numMips = 1;
|
||||
if (numMips)
|
||||
{
|
||||
if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
|
||||
*numMips = ddsHeader->numMips;
|
||||
else
|
||||
*numMips = 1;
|
||||
}
|
||||
|
||||
// FIXME: handle cube map
|
||||
//if ((ddsHeader->caps2 & DDSCAPS2_CUBEMAP) == DDSCAPS2_CUBEMAP)
|
||||
|
|
Loading…
Reference in a new issue