From e2aec8d52c79a88dd61b35c0a782cabaf51b8afe Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 7 Sep 2021 14:45:45 -0600 Subject: [PATCH] Fix an infinite loop in plDxPipeline. H'Uru PR #719 commit log: commit 5f53b86494605c484c0b304e0a5ab15a07929106 Author: Adam Johnson Date: Fri Sep 4 07:38:15 2020 -0400 Fix an infinite loop in plDXPipeline. This was observed in a 2x2 DXT1 mipmap produced by Korman. While Korman should probably force such a thing to be uncompressed, the pipeline should also not be able to enter such an obviously invalid state. M Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.cpp --- Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp index a8798467..2b67c678 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp @@ -8663,10 +8663,9 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, if( mipmap->IsCompressed() || !( fSettings.fD3DCaps & kCapsDoesSmallTextures ) ) { mipmap->SetCurrLevel( maxLevel ); - while( ( mipmap->GetCurrWidth() | mipmap->GetCurrHeight() ) & sizeMask ) + while( maxLevel > 0 && (( mipmap->GetCurrWidth() | mipmap->GetCurrHeight() ) & sizeMask) ) { maxLevel--; - hsAssert( maxLevel >= 0, "How was this ever compressed?" ); mipmap->SetCurrLevel( maxLevel ); } }