Sanity checking for frame and texuture hints from filenames.

This commit is contained in:
Kyzentun
2014-09-07 14:09:39 -06:00
parent d6205f2b84
commit 1ca9753e10
3 changed files with 33 additions and 7 deletions
+9 -2
View File
@@ -26,8 +26,15 @@ static void GetResolutionFromFileName( RString sPath, int &iWidth, int &iHeight
if( !re.Compare(sPath, asMatches) )
return;
iWidth = StringToInt( asMatches[0] );
iHeight = StringToInt( asMatches[1] );
// Check for nonsense values. Some people might not intend the hint. -Kyz
int maybe_width= StringToInt(asMatches[0]);
int maybe_height= StringToInt(asMatches[1]);
if(maybe_width <= 0 || maybe_height <= 0 || maybe_width > iWidth || maybe_height > iHeight)
{
return;
}
iWidth = maybe_width;
iHeight = maybe_height;
}
RageBitmapTexture::RageBitmapTexture( RageTextureID name ) :