Fix bug with handling explosions (wrong parameters passed to glTexSubImage2D) spotted by Tiyuri
authorunc0rr
Wed, 05 Mar 2008 19:34:52 +0000
changeset 797 e7fa1a1b9791
parent 796 81057bc8a02e
child 798 02753868d459
Fix bug with handling explosions (wrong parameters passed to glTexSubImage2D) spotted by Tiyuri
hedgewars/uLand.pas
--- a/hedgewars/uLand.pas	Tue Mar 04 21:33:10 2008 +0000
+++ b/hedgewars/uLand.pas	Wed Mar 05 19:34:52 2008 +0000
@@ -635,6 +635,9 @@
 begin
 if LandTexture <> nil then
    begin
+   if (Height <= 0) then exit;
+   TryDo((Y >= 0) and (Y < 1024), 'UpdateLandTexture: wrong Y parameter', true);
+   TryDo(Y + Height < 1024, 'UpdateLandTexture: wrong Height parameter', true);
    glBindTexture(GL_TEXTURE_2D, LandTexture^.id);
 
    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]);