mirror of https://github.com/OpenRCT2/OpenRCT2.git
Validate access to peep_loading_positions (#4475)
This commit is contained in:
parent
dccc9f88c2
commit
ff9417f4a6
|
@ -126,6 +126,7 @@ void RideObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
|||
numPeepLoadingPositions = stream->ReadValue<uint16>();
|
||||
}
|
||||
_peepLoadingPositions[i] = stream->ReadArray<sint8>(numPeepLoadingPositions);
|
||||
_peepLoadingPositionsCount[i] = numPeepLoadingPositions;
|
||||
}
|
||||
|
||||
GetImageTable()->Read(context, stream);
|
||||
|
@ -354,6 +355,9 @@ void RideObject::Load()
|
|||
set_vehicle_type_image_max_sizes(vehicleEntry, num_images);
|
||||
}
|
||||
vehicleEntry->peep_loading_positions = _peepLoadingPositions[i];
|
||||
#ifdef NO_RCT2
|
||||
vehicleEntry->peep_loading_positions_count = _peepLoadingPositionsCount[i];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ private:
|
|||
rct_ride_entry _legacyType = { 0 };
|
||||
vehicle_colour_preset_list _presetColours = { 0 };
|
||||
sint8 * _peepLoadingPositions[4] = { nullptr };
|
||||
uint16 _peepLoadingPositionsCount[4] = { 0 };
|
||||
|
||||
public:
|
||||
explicit RideObject(const rct_object_entry &entry) : Object(entry) { }
|
||||
|
|
|
@ -2778,6 +2778,9 @@ static void peep_update_ride_sub_state_1(rct_peep* peep){
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef NO_RCT2
|
||||
assert(peep->current_seat < vehicle_type->peep_loading_positions_count);
|
||||
#endif
|
||||
sint8 load_position = vehicle_type->peep_loading_positions[peep->current_seat];
|
||||
|
||||
switch (vehicle->sprite_direction / 8){
|
||||
|
|
|
@ -123,7 +123,7 @@ typedef struct rct_ride_entry {
|
|||
uint8 shop_item; // 0x1C0
|
||||
uint8 shop_item_secondary; // 0x1C1
|
||||
} rct_ride_entry;
|
||||
#ifdef PLATFORM_32BIT
|
||||
#if defined(PLATFORM_32BIT) && !defined(NO_RCT2)
|
||||
assert_struct_size(rct_ride_entry, 0x1c2);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -77,8 +77,11 @@ typedef struct rct_ride_entry_vehicle {
|
|||
uint8 draw_order;
|
||||
uint8 special_frames; // 0x60 , 0x7A
|
||||
sint8* peep_loading_positions; // 0x61 , 0x7B
|
||||
#ifdef NO_RCT2
|
||||
uint16 peep_loading_positions_count;
|
||||
#endif
|
||||
} rct_ride_entry_vehicle;
|
||||
#ifdef PLATFORM_32BIT
|
||||
#if defined(PLATFORM_32BIT) && !defined(NO_RCT2)
|
||||
assert_struct_size(rct_ride_entry_vehicle, 0x65);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue