Core/Misc: Throw an exception if client sends invalid float/double data

Throw a ByteBufferException if client sends 1.#INF0000, 1.#QNAN000, 1.#IND0000 or other invalid float/double values.
Handle this invalid values in StaticMapTree::isInLineOfSight() to avoid triggering an assert.
Fixes #12126
This commit is contained in:
jackpoz committed 2014-05-25 15:18:55 +02:00
1 parent 01b33a6772
commit 5e66253de2
2 files changed
+5 -2

No files matched your search

+1 -2
View File
@@ -157,8 +157,7 @@ namespace VMAP
{
float maxDist = (pos2 - pos1).magnitude();
// return false if distance is over max float, in case of cheater teleporting to the end of the universe
if (maxDist == std::numeric_limits<float>::max() ||
maxDist == std::numeric_limits<float>::infinity())
if (maxDist == std::numeric_limits<float>::max() || !isfinite(maxDist))
return false;
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too