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

Advanced Strategic Command (Debian: asc): crash + busy-loop #230

Closed
smcv opened this issue Oct 3, 2022 · 13 comments
Closed

Advanced Strategic Command (Debian: asc): crash + busy-loop #230

smcv opened this issue Oct 3, 2022 · 13 comments
Assignees
Milestone

Comments

@smcv
Copy link
Contributor

smcv commented Oct 3, 2022

Prerequisites:

  • Debian testing (Debian 12 alpha)
  • apt install asc (Debian package version 2.6.1.0-8+b1)
  • Relevant libraries:
    • libsdl1.2debian version 1.2.15+dfsg2-8 (real SDL 1.2)
    • libsdl1.2-compat version 1.2.56-2 from Debian (which is 1.2.56 + RestoreDestAlpha: Fix out-of-bounds access to buffer #212)
    • libsdl1.2-compat version 1.2.58 locally-built during Steam Runtime development
    • libsdl2-2.0-0 version 2.24.0+dfsg-1
    • libsdl-image1.2 version 1.2.12-13+b1
    • libsdl-mixer1.2 version 1.2.12-17
    • libsdl-sound1.2 version 1.0.3-9+b1

To reproduce:

  • Run asc
  • Click around a bit
  • Alt+F4 to exit
  • Run LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/sdl12-compat asc (using 1.2.56-2 from Debian)
  • Try to play the game for a few seconds as before
  • Run with 1.2.58 in the LD_LIBRARY_PATH
  • Try to play the game for a few seconds as before

Expected result: no crash

Actual result: the game segfaults. This backtrace is with 1.2.56:

#0  SaveDestAlpha (src12=0x561eecbdbfd0, dst12=0x561eecba4b80, dstrect12=0x0, retval=0x7ffc07053da8) at ./src/SDL12_compat.c:6061
#1  0x00007f83e73c47d8 in SDL_UpperBlit (src12=0x561eecbdbfd0, srcrect12=0x0, dst12=0x561eecba4b80, dstrect12=0x0)
    at ./src/SDL12_compat.c:6149
#2  0x0000561ee178983b in Surface::Duplicate (this=this@entry=0x561eeca8a938) at ./source/graphics/surface.cpp:91
#3  0x0000561ee165cf97 in OverviewMapHolder::drawNextField (this=0x561eeca8a928, signalOnCompletion=<optimized out>)
    at ./../../gamemap.cpp:148
#4  0x0000561ee165d02d in OverviewMapHolder::idleHandler (this=0x561eeca8a928) at ./../../gamemap.cpp:92
#5  0x0000561ee16c22ef in sigc::internal::signal_emit0<bool, sigc::nil>::emit (impl=0x561eeca99c10)
    at /usr/include/sigc++-2.0/sigc++/signal.h:709
#6  0x0000561ee16c250a in sigc::internal::signal_emit1<bool, PG_MessageObject*, sigc::nil>::emit (impl=0x561ee1cad750, 
    _A_a1=@0x7ffc07053fc8: 0x7ffc070540a0) at /usr/include/sigc++-2.0/sigc++/signal.h:952
#7  0x0000561ee1861af9 in sigc::signal1<bool, PG_MessageObject*, sigc::nil>::emit (_A_a1=@0x7ffc07053fc8: 0x7ffc070540a0, 
    this=<optimized out>) at /usr/include/sigc++-2.0/sigc++/signal.h:2954
#8  sigc::signal1<bool, PG_MessageObject*, sigc::nil>::operator() (_A_a1=@0x7ffc07053fc8: 0x7ffc070540a0, this=<optimized out>)
    at /usr/include/sigc++-2.0/sigc++/signal.h:2971
#9  PG_Widget::RunModal (this=this@entry=0x7ffc070540a0) at ./source/libs/paragui/src/widgets/pgwidget.cpp:1536
#10 0x0000561ee16bae30 in ASC_PG_Dialog::RunModal (this=this@entry=0x7ffc070540a0) at ./../../paradialog.cpp:480
#11 0x0000561ee16d71db in viewmessage (message=...) at ./../../messagedlg.cpp:581
#12 0x0000561ee16d7342 in viewunreadmessages (player=...) at ./../../messagedlg.cpp:639
#13 0x0000561ee16f055e in Event::execute (this=0x561eeca20cc0, md=0x561ee2af5590) at ./../../gameeventsystem.cpp:258
#14 0x0000561ee16f1854 in checkevents (gamemap=0x561eeca88470, md=0x561ee2af5590) at ./../../gameeventsystem.cpp:79
#15 0x0000561ee173b648 in next_turn (gamemap=<optimized out>, nextTurnStrategy=..., display=<optimized out>, 
    playerView=playerView@entry=-2) at ./../../turncontrol.cpp:288
#16 0x0000561ee1754b13 in gamethread (data=data@entry=0x7ffc07054650) at ./../../sg.cpp:1469
#17 0x0000561ee17827f1 in initializeEventHandling (gamethread=gamethread@entry=0x561ee17545a0 <gamethread(void*)>, 
    data=data@entry=0x7ffc07054650) at ./source/sdl/events.cpp:601
#18 0x0000561ee15d0bc1 in main (argc=<optimized out>, argv=<optimized out>) at ./../../sg.cpp:1761

If you're not familiar with Debian, it might be useful to know that you can enable coredump collection with sudo apt install systemd-coredump and debug the most recent one with DEBUGINFOD_URLS=https://debuginfod.debian.net coredumpctl gdb.

@smcv
Copy link
Contributor Author

smcv commented Oct 3, 2022

This looks to me like another regression in 812d58f? SDL_UpperBlit() handles a NULL dstrect12, but SaveDestAlpha doesn't.

@icculus icculus self-assigned this Oct 3, 2022
@icculus icculus added this to the 1.2.60 milestone Oct 3, 2022
icculus added a commit that referenced this issue Oct 4, 2022
@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

Crash is fixed, but the game is still hanging (or rather, looping with SDL_Delay(1) without doing anything else...I think).

@smcv
Copy link
Contributor Author

smcv commented Oct 4, 2022

It's entirely possible that the game is wrong - my attempts to test all Debian's remaining SDL 1.2 games for regressions with sdl12-compat are taking me on a pretty comprehensive tour of "my first open source game" projects...

@smcv
Copy link
Contributor Author

smcv commented Oct 4, 2022

FYI, I've added Debian testing/unstable packages starting with A to F to the Google spreadsheet of SDL 1.2 games. I briefly tested everything in that range that is a self-contained game in Debian. I haven't done bug reports for all the broken ones yet, because I want to go back to them and do better-quality bug reports with less abbreviated testing.

I mostly skipped non-games (emulators, music synths, etc.) and games that require external data. I also skipped games that used to require SDL 1.2 but have subsequently been ported to SDL 2, on the assumption that their SDL 2 ports will be preferred.

At some point I'll proceed through the rest of the alphabet, but there are lots of old SDL 1.2 games in Debian (many of them not really finished or release-quality IMO, but someone obviously disagreed enough to package them...) so it's a slow process.

@smcv smcv changed the title asc: Crashes shortly after startup Advanced Strategic Command (Debian: asc): crash + busy-loop Oct 4, 2022
@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

It's entirely possible that the game is wrong

In this case, it's definitely a sdl12-compat issue of some sort, since classic 1.2 works here. I am still digging further.

@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

Actually, it might just have been the one I built from source code that was broken; the Debian build isn't hanging with sdl12-compat, but I can't get the mouse to move up to the menu bar, so the struggle continues.

@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

what the heck, testsprite -fullscreen is doing it, too

@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

It's only reproducing on that one machine, which I'm willing to chalk up to some weird window manager or driver thing for now, but the hang is still happening on the other machine, with the debian package and only with sdl12-compat, so I'm going to look at that before closing this bug.

@smcv
Copy link
Contributor Author

smcv commented Oct 4, 2022

Please don't interpret this as being particularly high priority for me or anything - Debian's "popularity contest" says it's not a particularly widely-installed game, and I'd never installed it myself before yesterday. It just happens to have been near the beginning of the alphabet, and produced a crash report that looked useful.

@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

We're at the point where a lot of the popular things work really well, so I'm absolutely craving obscure things that stress the library in unexpected ways. :)

@icculus icculus closed this as completed in 4fc061c Oct 4, 2022
@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

Case in point: this turned out to be a really good fix that wasn't asc-specific! :)

@icculus
Copy link
Collaborator

icculus commented Oct 4, 2022

Quick note: the quirks for Civilization: Call to Power are no longer necessary to run the game, with this fix in place.

@smcv
Copy link
Contributor Author

smcv commented Oct 24, 2022

Confirmed fixed as of 67f8b3a (1.2.58 + 29 commits), although it's still suffering from #256.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants