Fix: CmdRemoveRoadStop didn't validate the height property properly (#9945)
Height was a unsigned 32bit integer, where TileAddWrap uses a signed 32bit integer for the height. In result, there was an implicit cast from unsigned to signed, messing things up. But looking at it from a functional perspective, allowing such large values is not sensible. In fact, width is restricted to just a 8bit integer. By changing height to a 8bit integer too, the implicit cast will never make a positive value negative anymore.
This commit is contained in:
@@ -2058,7 +2058,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
||||
* @param remove_road Remove roads of drive-through stops?
|
||||
* @return The cost of this operation or an error.
|
||||
*/
|
||||
CommandCost CmdRemoveRoadStop(DoCommandFlag flags, TileIndex tile, uint8 width, uint height, RoadStopType stop_type, bool remove_road)
|
||||
CommandCost CmdRemoveRoadStop(DoCommandFlag flags, TileIndex tile, uint8 width, uint8 height, RoadStopType stop_type, bool remove_road)
|
||||
{
|
||||
if (stop_type >= ROADSTOP_END) return CMD_ERROR;
|
||||
/* Check for incorrect width / height. */
|
||||
|
Reference in New Issue
Block a user