projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
15bf9a7
)
Fix signed overflow in getPointedThing
author
Bad-Command
<Corey.Edmunds@gmail.com>
Wed, 4 Jul 2012 19:06:19 +0000
(15:06 -0400)
committer
Perttu Ahola
<celeron55@gmail.com>
Sat, 21 Jul 2012 13:13:51 +0000
(16:13 +0300)
src/game.cpp
patch
|
blob
|
history
diff --git
a/src/game.cpp
b/src/game.cpp
index e2e6dd8c1774df7eec004603ae68b5a6e18feab7..347dbf44b163d2eb242cb7519791dbe6a050894e 100644
(file)
--- a/
src/game.cpp
+++ b/
src/game.cpp
@@
-367,6
+367,14
@@
PointedThing getPointedThing(Client *client, v3f player_position,
s16 zend = pos_i.Z + (camera_direction.Z>0 ? a : 1);
s16 xend = pos_i.X + (camera_direction.X>0 ? a : 1);
+ // Prevent signed number overflow
+ if(yend==32767)
+ yend=32766;
+ if(zend==32767)
+ zend=32766;
+ if(xend==32767)
+ xend=32766;
+
for(s16 y = ystart; y <= yend; y++)
for(s16 z = zstart; z <= zend; z++)
for(s16 x = xstart; x <= xend; x++)