Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d1x/d2x] Demo playback crashes #240

Closed
ghost opened this issue Oct 10, 2016 · 1 comment
Closed

[d1x/d2x] Demo playback crashes #240

ghost opened this issue Oct 10, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Oct 10, 2016

So I tried this with multiple demos so far and all of them seem to crash with the same backtrace:

#0  0x00007ffff64987eb in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
#1  0x00007ffff7bb64a1 in PHYSFS_read () from /usr/lib/libphysfs.so.1
#2  0x000000000047c907 in _newdemo_read (buffer=<optimized out>, elsize=elsize@entry=1, nelem=1) at similar/main/newdemo.cpp:293
#3  0x000000000047d8b2 in newdemo_read<signed char> (nelem=1, elsize=1, buffer=<optimized out>) at similar/main/newdemo.cpp:303
#4  nd_read_byte (b=<optimized out>) at similar/main/newdemo.cpp:423
#5  d1x::nd_read_object (obj=...) at similar/main/newdemo.cpp:606
#6  0x0000000000482c7f in d1x::newdemo_read_frame_information (rewrite=rewrite@entry=0) at similar/main/newdemo.cpp:2025
#7  0x00000000004863f0 in newdemo_playback_one_frame () at similar/main/newdemo.cpp:3664
#8  0x0000000000486e7a in d1x::newdemo_start_playback (filename=<optimized out>) at similar/main/newdemo.cpp:4046
#9  0x0000000000466693 in demo_menu_handler (lb=<optimized out>, event=..., items=<optimized out>) at similar/main/menu.cpp:748
#10 0x000000000048bae1 in listbox_key_command (lb=0x1940b80, event=...) at similar/main/newmenu.cpp:1864
#11 listbox_handler (wind=<optimized out>, event=..., lb=0x1940b80) at similar/main/newmenu.cpp:2062
#12 0x0000000000410396 in dcx::window_send_event (event=..., wind=...) at common/include/window.h:127
#13 dcx::event_send (event=...) at common/arch/sdl/event.cpp:132
#14 0x0000000000411670 in dcx::key_handler (kevent=kevent@entry=0x7fffffffe490) at common/arch/sdl/key.cpp:453
#15 0x000000000041058a in dcx::event_poll () at common/arch/sdl/event.cpp:47
#16 0x00000000004105c8 in dcx::event_process () at common/arch/sdl/event.cpp:154
#17 0x000000000040ace8 in d1x::main (argv=<optimized out>, argc=<optimized out>) at similar/main/inferno.cpp:589
#18 main (argc=<optimized out>, argv=<optimized out>) at similar/main/inferno.cpp:627

I have not bisected this yet, unfortunately as my local copy still has the pending Tracker changed not yet committed but this must be a very recent regression as I was playing back demos fine 2 or 3 weeks ago.

@vLKp
Copy link
Contributor

vLKp commented Oct 12, 2016

A quick demo here runs fine, but the demo shipped with Descent 2 is broken. I see the problem. An address-of was lost during conversion to C++ casts. Shockingly, the demo system's rampant abuse of casts led to a trivial code error being permitted by the compiler (because casts override some safety checks), so we get a runtime crash instead of a nice compile time error. Removing the casts and instead using overloads fixes the problem and makes the code more resistant to similar mistakes. In particular, there were several bogus uses of nd_read_short on values that were only one byte wide. These uses became compile errors when the casts were removed.

@vLKp vLKp added the bug label Oct 12, 2016
@vLKp vLKp added this to the 0.60 milestone Oct 12, 2016
@vLKp vLKp self-assigned this Oct 12, 2016
@vLKp vLKp closed this as completed Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant