(svn r23148) -Change: [NewGRF] Check the results of various callbacks for validness.

This commit is contained in:
frosch
2011-11-08 17:27:13 +00:00
parent 30874b5e81
commit 52774235eb
8 changed files with 44 additions and 5 deletions

View File

@@ -165,6 +165,7 @@ static uint GetRoadVehLength(const RoadVehicle *v)
uint16 veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, v->engine_type, v);
if (veh_len != CALLBACK_FAILED) {
if (veh_len >= VEHICLE_LENGTH) ErrorUnknownCallbackResult(v->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
length -= Clamp(veh_len, 0, VEHICLE_LENGTH - 1);
}