Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#228 segfault in src/cpu/core_dyn_x86/cache.h

SVN
closed
None
5
2012-11-28
2005-05-13
Unavowed
No

I get random segfaults when playing Syndicate Wars
using the dynamic core.

(gdb) where

0 0x08088417 in CacheBlock::Clear (this=0x91e1040) at

cache.h:239

1 0x08088212 in MakeCodePage (lin_page=524) at

cache.h:150

2 0x0808a5be in decode_fetchb () at decoder.h:64

3 0x0808e294 in CreateCacheBlock (codepage=0x66,

start=32, max_opcodes=31)
at decoder.h:1036

4 0x080902c3 in CPU_Core_Dyn_X86_Run () at

core_dyn_x86.cpp:209

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

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

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

at callback.cpp:105

8 0x080fc202 in DOS_Shell::Execute (this=0xbfffae80,

name=0xbfff8c1d "\r",
args=0x20 <Address 0x20="" out="" of="" bounds="">) at
shell_misc.cpp:454

9 0x080f8559 in DOS_Shell::DoCommand (this=0xbfffae80,

line=0xbfffaed7 " C:\\MAIN.EXE") at shell_cmds.cpp:113

10 0x080f5d2a in DOS_Shell::ParseLine (this=0xbfffae80,

line=0xbfffaed1 "DOS4GW C:\\MAIN.EXE") at shell.cpp:208

11 0x080f615e in DOS_Shell::Run (this=0x99ec270) at

shell.cpp:252

12 0x080efc34 in PROGRAMS_Handler () at programs.cpp:82

13 0x0804d9bd in Normal_Loop () at dosbox.cpp:127

14 0x0804da06 in DOSBOX_RunMachine () at dosbox.cpp:170

15 0x0804eb06 in CALLBACK_RunRealInt (intnum=33 '!')

at callback.cpp:105

16 0x080fc202 in DOS_Shell::Execute (this=0x99ea1f0,

name=0xbfffbf71 "\rC

\"/home/users/silent/games/swars\"\r",
args=0x20 <Address 0x20="" out="" of="" bounds="">) at
shell_misc.cpp:454

(gdb) frame 0

0 0x08088417 in CacheBlock::Clear (this=0x91e1040) at

cache.h:239
239
wherelink=&(*wherelink)->link[ind].next;

The code in that place looks like this:
CacheBlock *
wherelink=&link[ind].to->link[ind].from;
while (
wherelink!=this) {

wherelink=&(*wherelink)->link[ind].next;
}

(gdb) p link[ind].to->link[ind]
$14 = {to = 0x938b780, next = 0x0, from = 0x0}

The problem is that from is set to 0.

I don't know the logic of this code and whether a null
value at this place is legal, but adding a simple check
for it would probably help.

Discussion

  • Peter Veenstra
    Peter Veenstra
    2005-06-22

    Logged In: YES
    user_id=535630

    added a workaround for it.