Update STR handling to reject for-sure invalid framing values
This commit is contained in:
parent
69569a5be5
commit
5acc3afcb6
1 changed files with 33 additions and 0 deletions
|
|
@ -173,6 +173,7 @@ namespace TShockAPI.Handlers
|
||||||
}
|
}
|
||||||
|
|
||||||
NetTile newTile = tiles[x, y];
|
NetTile newTile = tiles[x, y];
|
||||||
|
|
||||||
TileObjectData data;
|
TileObjectData data;
|
||||||
|
|
||||||
// If the new tile has an associated TileObjectData object, we take the tile and the surrounding tiles that make up the tile object
|
// If the new tile has an associated TileObjectData object, we take the tile and the surrounding tiles that make up the tile object
|
||||||
|
|
@ -210,10 +211,26 @@ namespace TShockAPI.Handlers
|
||||||
case TileID.ShimmerMonolith:
|
case TileID.ShimmerMonolith:
|
||||||
{
|
{
|
||||||
// Allowed changes
|
// Allowed changes
|
||||||
|
|
||||||
|
// Based on empirical tests, these should be some conservative upper bounds for framing values
|
||||||
|
if (newTile.FrameX != -1 || newTile.FrameY != -1)
|
||||||
|
{
|
||||||
|
if (newTile.FrameX is < 0 or > 1000)
|
||||||
|
{
|
||||||
|
processed[x, y] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (newTile.FrameY is < 0 or > 5000)
|
||||||
|
{
|
||||||
|
processed[x, y] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
processed[x, y] = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -233,10 +250,26 @@ namespace TShockAPI.Handlers
|
||||||
case TileID.TargetDummy:
|
case TileID.TargetDummy:
|
||||||
{
|
{
|
||||||
// Allowed placements
|
// Allowed placements
|
||||||
|
|
||||||
|
// Based on empirical tests, these should be some conservative upper bounds for framing values
|
||||||
|
if (newTile.FrameX != -1 || newTile.FrameY != -1)
|
||||||
|
{
|
||||||
|
if (newTile.FrameX is < 0 or > 1000)
|
||||||
|
{
|
||||||
|
processed[x, y] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (newTile.FrameY is < 0 or > 500)
|
||||||
|
{
|
||||||
|
processed[x, y] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
processed[x, y] = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue