add invalid entry pointer guards.

update the changelog
This commit is contained in:
Tomas Dittmann 2017-07-13 00:06:42 +02:00 committed by Michael Steenbeek
parent e7bacc6d84
commit 77a6207100
6 changed files with 27 additions and 14 deletions

View File

@ -1,6 +1,9 @@
0.1.1 (in development)
------------------------------------------------------------------------
- Fix: [#3589] Crash due to invalid footpathEntry in path_paint
- Fix: [#4931] Crash in path_paint - footpathentry was null
0.1.0 (2017-07-12)
------------------------------------------------------------------------
- Feature: [#1399 (partial), #5177] Add window that displays any missing/corrupt objects when loading a park

View File

@ -214,8 +214,10 @@ static void park_entrance_paint(uint8 direction, sint32 height, rct_map_element*
switch (part_index){
case 0:
image_id = (path_entry->image + 5 * (1 + (direction & 1))) | ghost_id;
sub_98197C(image_id, 0, 0, 32, 0x1C, 0, height, 0, 2, height, get_current_rotation());
if (path_entry != (void*)-1) {
image_id = (path_entry->image + 5 * (1 + (direction & 1))) | ghost_id;
sub_98197C(image_id, 0, 0, 32, 0x1C, 0, height, 0, 2, height, get_current_rotation());
}
entrance = (rct_entrance_type*)object_entry_groups[OBJECT_TYPE_PARK_ENTRANCE].chunks[0];
image_id = (entrance->image_id + direction * 3) | ghost_id;

View File

@ -765,12 +765,15 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
}
uint8 pathType = (map_element->properties.path.type & 0xF0) >> 4;
rct_footpath_entry * footpathEntry = gFootpathEntries[pathType];
rct_footpath_entry * footpathEntry = get_footpath_entry(pathType);
if (footpathEntry->support_type == FOOTPATH_ENTRY_SUPPORT_TYPE_POLE) {
path_paint_pole_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
} else {
path_paint_box_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
if (footpathEntry != (void*)-1) {
if (footpathEntry->support_type == FOOTPATH_ENTRY_SUPPORT_TYPE_POLE) {
path_paint_pole_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
}
else {
path_paint_box_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
}
}
#ifdef __ENABLE_LIGHTFX__

View File

@ -188,6 +188,9 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY;
uint32 ebp = mapElement->properties.scenerymultiple.type >> 10;
rct_scenery_entry *entry = get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF);
if (entry == (void*)-1)
return;
uint32 image_id = (ebp << 2) + entry->image + 4 + direction;
rct_large_scenery_tile *tile = &entry->large_scenery.tiles[ebp];
uint32 dword_F4387C = 0;

View File

@ -315,7 +315,7 @@ static bool is_jumping_fountain(sint32 type, sint32 x, sint32 y, sint32 z)
uint8 additionIndex = footpath_element_get_path_scenery_index(mapElement);
rct_scenery_entry * sceneryEntry = get_footpath_item_entry(additionIndex);
if (sceneryEntry->path_bit.flags & pathBitFlagMask)
if (sceneryEntry != reinterpret_cast<void*>(-1) && sceneryEntry->path_bit.flags & pathBitFlagMask)
{
return true;
}

View File

@ -93,12 +93,14 @@ void scenery_update_tile(sint32 x, sint32 y)
scenery_update_age(x, y, mapElement);
} else if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_PATH) {
if (footpath_element_has_path_scenery(mapElement) && !footpath_element_path_scenery_is_ghost(mapElement)) {
rct_scenery_entry *sceneryEntry;
sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(mapElement));
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER) {
jumping_fountain_begin(JUMPING_FOUNTAIN_TYPE_WATER, x, y, mapElement);
} else if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW) {
jumping_fountain_begin(JUMPING_FOUNTAIN_TYPE_SNOW, x, y, mapElement);
rct_scenery_entry *sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(mapElement));
if (sceneryEntry != (void*)-1) {
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER) {
jumping_fountain_begin(JUMPING_FOUNTAIN_TYPE_WATER, x, y, mapElement);
}
else if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW) {
jumping_fountain_begin(JUMPING_FOUNTAIN_TYPE_SNOW, x, y, mapElement);
}
}
}
}