Khronos Public Bugzilla
Bug 571 - pIsMipmapped is incorrectly referenced in ktxLoadTextureF
pIsMipmapped is incorrectly referenced in ktxLoadTextureF
Status: RESOLVED FIXED
Product: KTX
Classification: Unclassified
Component: library
unspecified
All All
: P3 major
: ---
Assigned To: Mark Callow
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-09 11:35 PST by Krystian Bigaj
Modified: 2012-01-17 19:18 PST (History)
0 users

See Also:


Attachments
Patch for loader.c to fix this bug (436 bytes, patch)
2012-01-09 11:35 PST, Krystian Bigaj
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Krystian Bigaj 2012-01-09 11:35:13 PST
Created attachment 90 [details]
Patch for loader.c to fix this bug

In file "loader.c" there is code:

if (*pIsMipmapped) {
	if (texinfo.generateMipmaps || header.numberOfMipmapLevels > 1)
		*pIsMipmapped = GL_TRUE;
	else
		*pIsMipmapped = GL_FALSE;
}

Documentation states that pIsMipmapped can be NULL, but in this case you will get Access Violation (derefrence from NULL). Also *pIsMipmapped will be only set if (*pIsMipmapped != 0), so result value pIsMipmapped from ktxLoadTextureF/N might be unreliable.

To fix it, change line:
  if (*pIsMipmapped) {
to:
  if (pIsMipmapped) {

(Patch included in attachment from latests svn sources)
Comment 1 Mark Callow 2012-01-17 19:18:19 PST
In SVN r16605.