Certain old replays desync worse than they used to
Yesterday I got a Metal Sonic replay in Arid Canyon Zone 2 from Duckinsurance. The replay could be viewed, and the replay looks fine for the most part, apart from small desyncs that plague replays anyway. But when you try to race against it, the ghost would teleport to hell immediately after starting. Duckinsurance's game sigsegved after five seconds of racing against the ghost, though I can't recreate that. The crash log he sent:
An error occurred within SRB2! Send this stack trace to someone who can help! (Or find crash-log.txt in your SRB2 directory.)
Backtrace: srb2(+0x1e710b)[0x562acddf210b] srb2(+0x1e724c)[0x562acddf224c] /lib/x86_64-linux-gnu/libc.so.6(+0x46210)[0x7f84caae5210] srb2(+0x127ac6)[0x562acdd32ac6] srb2(+0x8e532)[0x562acdc99532] srb2(+0x176701)[0x562acdd81701] srb2(+0x9e163)[0x562acdca9163] srb2(+0x5c588)[0x562acdc67588] srb2(+0x50c8c)[0x562acdc5bc8c] srb2(main+0x7a)[0x562acdc5a93a] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f84caac60b3] srb2(+0x4fb7e)[0x562acdc5ab7e]
`Process killed by signal: SIGSEGV - segment violation (core dumped)```
The bug doesn't seem to happen when racing against the ghost in SRB2 v2.2.8, but it does in v2.2.9. My first guess was that something has to be wrong with the fixes I made in demo reading/writing. That doesn't seem to be the case though, since reverting commits from merge requests !1157 (merged) and !1241 (merged) didn't solve the problem.
The replay was made in SRB2 v2.2.3, so it's quite old. This doesn't mean it couldn't happen with newer replays, though it is not yet confirmed. The first 5 frames of the replay result in these positions:
Player coordinates: x: 1136, y: -17520, z: 984, Ghost coordinates: x: 1136, y: -17520, z:, 984 Player coordinates: x: 1136, y: -17520, z: 984, Ghost coordinates: x: 4096, y: 5120, z:, -143 Player coordinates: x: 1136, y: -17520, z: 984, Ghost coordinates: x: -16107, y: 255, z:, -18206 Player coordinates: x: 1136, y: -17520, z: 984, Ghost coordinates: x: -16107, y: 255, z:, -18206 Player coordinates: x: 1136, y: -17520, z: 984, Ghost coordinates: x: -16107, y: 255, z:, -18206
,
where Player is the player you play as, and Ghost is the ghost you race against. The distances are divided by FRACUNIT for readability. The movement on first two frames is obviously not correct. In fact, he only starts moving on frame 52 after ending a spin. (According to a replay data viewer program made for speedrun moderation) The ghost, however, starts moving on frame 47 already, according to a log done with CONS_Printf every frame, so apparently some frames are skipped from the beginning.
Edit: removed a section of speculation. The reason and the fix have been explained in !1545 (merged) .
Duck's replay as an attachment: MAP14-metalsonic-time-best.lmp! Duck's video of the crash. Apparently the time when the crash happens varies. acz2mghostsigsegv