Fix crash when tga image loader succeeds in loading a 0x0 image

Copy resource bitmaps before using them on a worker thread
This commit is contained in:
Magnus Norddahl 2020-03-19 15:46:04 +01:00
parent e19b2912f3
commit 44d972c876
4 changed files with 14 additions and 5 deletions

View file

@ -165,10 +165,10 @@ namespace CodeImp.DoomBuilder.Data
data.Position += 9; // Skip some stuff...
int width = data.ReadByte() + (data.ReadByte() << 8);
if(width < 0 || width > 8192) return false;
if(width <= 0 || width > 8192) return false;
int height = data.ReadByte() + (data.ReadByte() << 8);
if(height < 0 || height > 8192) return false;
if(height <= 0 || height > 8192) return false;
int bitsperpixel = data.ReadByte(); // Can be 8, 16, 24, 32
return (bitsperpixel == 8 || bitsperpixel == 16 || bitsperpixel == 24 || bitsperpixel == 32);