dxx-rebirth
dxx-rebirth copied to clipboard
Bogus segment_none in guidebot path
A Future Pilot reported a crash in openable_door_on_near_path with callstack:
#5 0x00007ffff6cdc0b8 in __cxa_throw () from /usr/lib/libstdc++.so.6
#6 0x0000000000436555 in check_index_range<segment_array_t> (
s=<optimized out>, a=<optimized out>) at common/include/valptridx.h:80
#7 vvalptr_t<segment, short>::vvalptr_t<segment_array_t> (
this=this@entry=0x7fffffffe450, a=<optimized out>, i=<optimized out>)
at common/include/valptridx.h:444
#8 0x000000000042f8dd in vsegptr_t<segment_array_t> (this=0x7fffffffe450)
at common/main/segment.h:223
#9 operator() (i=<optimized out>, this=<synthetic pointer>)
at common/include/valptridx.h:560
#10 openable_door_on_near_path (aip=
@0x103b3e8: {<prohibit_void_ptr<ai_static>> = {<No data fields>}, behavior = ai_behavior::AIB_NORMAL, flags = {_M_elems = "\000\003\003\001\000\000\000\000\377\000"}, hide_segment = 0, hide_index = 1161, path_length = 4, cur_path_index = 3 '\003', dying_sound_playing = 0 '\000', danger_laser_num = -1, danger_laser_signature = {signature = 0}, dying_start_time = 0, ail = {<prohibit_void_p---Type <return> to continue, or q <return> to quit---
tr<ai_local>> = {<No data fields>}, player_awareness_type = player_awareness_type_t::PA_WEAPON_WALL_COLLISION, retry_count = 0 '\000', consecutive_retries = 0 '\000', previous_visibility = 2 '\002', rapidfire_count = 0 '\000', mode = ai_mode::AIM_GOTO_PLAYER, goal_segment = 939, next_action_time = -19291243, next_fire = -30802, next_fire2 = 524288, player_awareness_time = 93782, time_since_processed = 0, time_player_seen = 25679561, time_player_sound_attacked = 23320724, next_misc_sound_time = 25791802, goal_angles = {_M_elems = {{p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}}}, delta_angles = {_M_elems = {{p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}, {p = 0, b = 0, h = 0}}}, goal_state = {_M_elems = "\006\000\000\000\000\000\000\000\000"}, achieved_state = {_M_elems = "\000\000\000\000\000\000\000\000\000"}}}, obj=<optimized out>)
at similar/main/ai.cpp:2882
#11 0x000000000043186a in do_ai_frame (obj=
{<prohibit_void_ptr<vobjptridx_t>> = {<No data fields>}, <valptridx_template_t<true, object, short, object_magic_constant_t, object>> = {<vvalptr_t<object, short>> = {<valptr_t<object, short>> = {<valbaseptridxutil_t<object, short>> = {<No data fields>}, p = 0x103b300 <Objects+40832>}, <No data fields>}, <vvalidx_t<object, short, object_magic_constant_t>> = {<validx_t<object, short, object_magic_constant_t>> = {<valbaseptridxutil_t<object, short>> = {<No data fiel---Type <return> to continue, or q <return> to quit---
ds>}, i = 88}, <No data fields>}, <No data fields>}, <No data fields>})
at similar/main/ai.cpp:3475
#12 0x00000000004bc262 in object_move_one (obj=
{<prohibit_void_ptr<vobjptridx_t>> = {<No data fields>}, <valptridx_template_t<true, object, short, object_magic_constant_t, object>> = {<vvalptr_t<object, short>> = {<valptr_t<object, short>> = {<valbaseptridxutil_t<object, short>> = {<No data fields>}, p = 0x103b300 <Objects+40832>}, <No data fields>}, <vvalidx_t<object, short, object_magic_constant_t>> = {<validx_t<object, short, object_magic_constant_t>> = {<valbaseptridxutil_t<object, short>> = {<No data fields>}, i = 88}, <No data fields>}, <No data fields>}, <No data fields>})
at similar/main/object.cpp:1687
#13 0x00000000004bd178 in object_move_all () at similar/main/object.cpp:1875
#14 0x000000000045b7cb in GameProcessFrame () at similar/main/game.cpp:1331
This can be reproduced on Descent 2: Counterstrike mission 1 Ahayweh Gate by releasing the guidebot, then waiting in segment 69 or segment 70 for the guidebot to enter "coming back to get you" mode after it seeks the red key. Commit e590cc59ee918a390cce18c12d18e7c52ad772ce adds a workaround to detect and ignore the bogus values, but the problem should be fixed at its source by preventing the game from using paths with bogus segment_none entries. I suspect that the bogus entry is created by insert_center_points, but the post-processing should have removed the bogus entries from the active path.