Menu

#213 pcspeaker=false might crash

SVN
closed
Qbix
sound (29)
5
2012-11-28
2005-02-04
No

CVS from 05-02-02 compiled on cygwin using gcc 3.4.1
running MAX 1.04d among others) with any core and
pcspeaker=false.

I haven't extensively tested all sound combinations,
but the bug happens with MAX configured to no sound and
gus sound while with pcspeaker=true both work as expected.

Looking at the code it crashes because
PCSPEAKER_SetCounter is called while spkr.chan is null
which only gets initialized with pcspeaker=true. The
workaround is to simply set pcspeaker=true. The correct
fix is probably to either prevent calling
PCSPEAKER_SetCounter in write_latch or initialize
spkr.chan to some noop implementation in the
pcspeaker=false case (the second variant should have no
performance impact on the pcspeaker=true case).

The gdb stack trace (using core=normal) looks as follows:

0 0x00473501 in MixerChannel::Enable (this=0x0,

_yesno=true) at mixer.cpp:137

1 0x0046d364 in PCSPEAKER_SetCounter (cntr=65536,

mode=2) at pcspeaker.cpp:161

2 0x004783ea in write_latch (port=66, val=0, iolen=1)

at timer.cpp:163

3 0x0047b4e7 in IO_WriteB (port=66, val=0) at

iohandler.cpp:167

4 0x004381ea in CPU_Core_Normal_Run () at

core_normal/prefix_none.h:922

5 0x00401296 in Normal_Loop () at dosbox.cpp:124

6 0x0040137d in DOSBOX_RunMachine () at dosbox.cpp:170

7 0x00405bc1 in CALLBACK_RunRealInt (intnum=33 '!')

at callback.cpp:103

8 0x004af45b in DOS_Shell::Execute (this=0x49a5f68,

name=0x22db10 ".\DOS32A", args=0x22ebf8 " MAXRUN -f.")
at shell_misc.cpp:441

9 0x004b067f in DOS_Shell::DoCommand (this=0x49a5f68,

line=0x22ebf8 " MAXRUN -f.") at shell_cmds.cpp:98

10 0x004ac564 in DOS_Shell::ParseLine (this=0x49a5f68,

line=0x22ebf0 ".\DOS32A MAXRUN -f.") at shell.cpp:146

11 0x004aca20 in DOS_Shell::Run (this=0x49a5f68) at

shell.cpp:209

12 0x004ad7a2 in SHELL_Init () at shell.cpp:424

13 0x004a8fe8 in Config::StartUp (this=0x22fe20) at

setup.cpp:327

14 0x0048b8b1 in SDL_main (argc=3, argv=0x22fea0) at

sdlmain.cpp:1127

15 0x004b3992 in console_main (argc=3, argv=0x22fea0)

at win32/SDL_win32_main.c:249

16 0x004b3b3e in WinMain (hInst=0x400000, hPrev=0x0,

szCmdLine=0x241ef6 "MAX -noconsole", sw=10) at
win32/SDL_win32_main.c:361

17 0x004b346a in main () at ../../include/mem.h:183

Sorry if this is a duplicate, but I couldn't find
anything related to this after a brief search.

Discussion

  • Qbix

    Qbix - 2005-02-07

    Logged In: YES
    user_id=535630

    2005-02-03 11:34 qbix79

    * src/hardware/pcspeaker.cpp: Only do things with the
    

    channel if it
    actually is present. Fixes some crashes with pcspeaker
    disabled

    I didn't saw this report actually, but could you test a
    current cvs to see wether my changes influence the behaviour ?

     
  • Jürgen Rühle

    Jürgen Rühle - 2005-02-07

    Logged In: YES
    user_id=839597

    Yes, that fixes it. Sorry that my report was late.

     
  • Qbix

    Qbix - 2005-02-07

    Logged In: YES
    user_id=535630

    good. no need to appologize.
    I was just "amazed" as I read the report after I commited
    the fix.

    I'm glad it's fixed. Will close the report now.

     

Log in to post a comment.