mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-22 18:51:05 +00:00
Fix crash if both image_useCache and image_downSize are 1
the commented out code clamped the loaded filesize of affected .dds images (crash observed with dds/guis/assets/splash/pdtempa.dds) to 200KB - but then later tries to load it and skip the first mipmap, resuling in reading invalid memory (> 200KB into the file). No idea what this was supposed to achieve, but it's disabled now and the crash (at startup) is gone. fixes #374
This commit is contained in:
parent
5f346c7355
commit
409dd8e3d9
1 changed files with 6 additions and 0 deletions
|
@ -1373,9 +1373,15 @@ bool idImage::CheckPrecompressedImage( bool fullLoad ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if 0 // DG: no idea what this was exactly meant to achieve, but it's definitely a bad idea:
|
||||
// we might try to load the lower mipmap levels of the image, but we'd still have
|
||||
// to load the whole .dds file first.
|
||||
// What's even weirder: idImage::ShouldImageBePartiallyCached() returns false
|
||||
// if the file size is LESS THAN image_cacheMinK * 1024...
|
||||
if ( !fullLoad && len > globalImages->image_cacheMinK.GetInteger() * 1024 ) {
|
||||
len = globalImages->image_cacheMinK.GetInteger() * 1024;
|
||||
}
|
||||
#endif
|
||||
|
||||
byte *data = (byte *)R_StaticAlloc( len );
|
||||
|
||||
|
|
Loading…
Reference in a new issue