Skip to content

Commit 3e30731

Browse files
authoredFeb 6, 2017
Prevent SIGFPE on entity tile loading issue. (#5178)
While experimenting with entities I ran into this unresolvable error where the server is sending some texture that the client crashes on. The crash prevents the client from ever reconnecting, resulting in a server that has to use clearobjects. We shouldn't crash but just ignore the object and move on. ``` 0x00000000004dc0de in TextureSource::generateImagePart (this=this@entry=0x7118eb0, part_of_name="[applyfiltersformesh", baseimg=@0x7fffffffbe98: 0x9f1b010) at /home/sofar/git/minetest/src/client/tile.cpp:1744 1744 u32 xscale = scaleto / dim.Width; (gdb) bt #0 0x00000000004dc0de in TextureSource::generateImagePart (this=this@entry=0x7118eb0, part_of_name="[applyfiltersformesh", baseimg=@0x7fffffffbe98: 0x9f1b010) at /home/sofar/git/minetest/src/client/tile.cpp:1744 ``` After reconnecting, the client now can connect without issues and displays an error message: ``` ERROR[Main]: generateImagePart(): Illegal 0 dimension for part_of_name="[applyfiltersformesh", cancelling. ERROR[Main]: generateImage(): Failed to generate "[applyfiltersformesh" ERROR[Main]: Irrlicht: Invalid size of image for OpenGL Texture. ```
1 parent 80c7527 commit 3e30731

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

Diff for: ‎src/client/tile.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,12 @@ bool TextureSource::generateImagePart(std::string part_of_name,
17411741
* equal to the target minimum. If e.g. this is a vertical frames
17421742
* animation, the short dimension will be the real size.
17431743
*/
1744+
if ((dim.Width == 0) || (dim.Height == 0)) {
1745+
errorstream << "generateImagePart(): Illegal 0 dimension "
1746+
<< "for part_of_name=\""<< part_of_name
1747+
<< "\", cancelling." << std::endl;
1748+
return false;
1749+
}
17441750
u32 xscale = scaleto / dim.Width;
17451751
u32 yscale = scaleto / dim.Height;
17461752
u32 scale = (xscale > yscale) ? xscale : yscale;

0 commit comments

Comments
 (0)
Please sign in to comment.