Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#3273 closed defect (fixed)

BS2: Crash after Intro

Reported by: lordhoto Owned by: SF/robinwatts
Priority: normal Component: Engine: Sword2
Keywords: Cc:
Game: Broken Sword 2

Description

ScummVM 0.11.0 SVN (20070625) on Linux/AMD64.

After the intro finishes the game crashes with a segmentation fault. Here's the gdb backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1090525504 (LWP 10258)]
0x0000000000513967 in Audio::LinearRateConverter<false, false>::flow (this=0xeb2a20, input=@0x7e1f70, obuf=0x85cdd8, osamp=2048,
vol_l=192, vol_r=192) at sound/rate.cpp:250
250 icur0 = *inPtr++;
(gdb) bt
#0 0x0000000000513967 in Audio::LinearRateConverter<false, false>::flow (this=0xeb2a20, input=@0x7e1f70, obuf=0x85cdd8, osamp=2048,
vol_l=192, vol_r=192) at sound/rate.cpp:250
#1 0x00000000004fe923 in Audio::Channel::mix (this=0x871710, data=0x85bde0, len=2048) at sound/mixer.cpp:430
#2 0x00000000004ff712 in Audio::Mixer::mix (this=0x843e10, buf=0x85bde0, len=2048) at sound/mixer.cpp:214
#3 0x00000000004ff7a0 in Audio::Mixer::mixCallback (s=0x843e10, samples=0x85bde0 "����1", len=8192) at sound/mixer.cpp:223
#4 0x00002ab1e8b5f51a in ?? () from /usr/lib/libSDL-1.2.so.0
#5 0x00002ab1e8b67207 in ?? () from /usr/lib/libSDL-1.2.so.0
#6 0x00002ab1e8ba8e49 in ?? () from /usr/lib/libSDL-1.2.so.0
#7 0x00002ab1e9ada2a5 in start_thread () from /lib/libpthread.so.0
#8 0x00002ab1e985261d in clone () from /lib/libc.so.6
#9 0x0000000000000000 in ?? ()

Ticket imported from: #1743016. Ticket imported from: bugs/3273.

Change History (9)

comment:1 Changed 12 years ago by bluegr

It crashes for me as well, at rate.cpp line 250 under Windows Vista (same as Lordhoto). After the intro (you can skip it, it doesn't matter), you see the screen with the spider and the flames, and once the spider starts walking to the right towards George, ScummVM crashes.

There is no crash with the 0.10.0 version

comment:2 Changed 12 years ago by fingolfin

Owner: set to SF/robinwatts

comment:3 Changed 12 years ago by fingolfin

So this is likely caused by the rate conversion improvements we recently made. Robin, any insights on this? Since that patch was by you... But of course the cause could just as well be one of the subsequent changes I made -- however, I don't have the time to look into this myself right now, so just in case you have time to look at it before I have... :-)

comment:4 Changed 12 years ago by eriktorbjorn

I think I see the problem with the LinearMemoryStream, at least.

Before the change, 'len' was the length of the smaller of the input/output buffer, and we limited the total number of samples to numSamples.

After the change, 'len' is the number of samples to read, no matter how many samples we've alread read.

What happens in Broken Sword 2 is that the output buffer is 512 samples, and it's a looping sound. When it reaches the end of the sample, it reads the 312 remaining samples, prepares to loop the sound, and then reads another 512 samples.

I have a feeling than any quick fix I could try to make right now would end up making things unreadable. So I won't. Any other takers? :-)

comment:5 Changed 12 years ago by SF/robinwatts

eriktorbjorn is spot on. The problem there is a typo. I say:

len = MIN(numSamples,...

when I should say:

len = MIN(samples,...

I've committed this fix. eriktorbjorn now says it's fixed, but [md5] reports continued troubles.

comment:6 Changed 12 years ago by bluegr

md5: I was mistaken, with the fix from robinwatts BS2 works fine now for me

comment:7 Changed 12 years ago by SF/robinwatts

Closing, believed fixed.

comment:8 Changed 12 years ago by SF/robinwatts

Status: newclosed

comment:9 Changed 12 years ago by fingolfin

Resolution: fixed
Note: See TracTickets for help on using tickets.