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);
|
len -= 4 + sizeof(*ddsHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
*width = ddsHeader->width;
|
if (width)
|
||||||
*height = ddsHeader->height;
|
*width = ddsHeader->width;
|
||||||
|
if (height)
|
||||||
|
*height = ddsHeader->height;
|
||||||
|
|
||||||
if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
|
if (numMips)
|
||||||
*numMips = ddsHeader->numMips;
|
{
|
||||||
else
|
if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
|
||||||
*numMips = 1;
|
*numMips = ddsHeader->numMips;
|
||||||
|
else
|
||||||
|
*numMips = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: handle cube map
|
// FIXME: handle cube map
|
||||||
//if ((ddsHeader->caps2 & DDSCAPS2_CUBEMAP) == DDSCAPS2_CUBEMAP)
|
//if ((ddsHeader->caps2 & DDSCAPS2_CUBEMAP) == DDSCAPS2_CUBEMAP)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue