Opened 10 years ago

Closed 9 years ago

Last modified 6 months ago

#4636 closed defect (fixed)

MIXER: Division by 0 in rate conversion if w/o soundcd

Reported by: SF/jmmdebian Owned by: fingolfin
Priority: low Component: Audio
Keywords: Cc:
Game:

Description

This was originally filed in the Debian Bug Tracking system:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540166

I can reproduce this with 1.0-rc1 by rmmod'ing all sound card modules:

Program received signal SIGFPE, Arithmetic exception.
0x0878e47b in Audio::makeRateConverter<false, false> (inrate=10426, outrate=0) at sound/rate.cpp:333
333 if ((inrate % outrate) == 0) {
(gdb) bt
#0 0x0878e47b in Audio::makeRateConverter<false, false> (inrate=10426, outrate=0) at sound/rate.cpp:333
#1 0x0878d1a9 in Audio::makeRateConverter (inrate=10426, outrate=0, stereo=false, reverseStereo=false)
at sound/rate.cpp:353
#2 0x0876d4b7 in Channel (this=0x8b2c188, mixer=0x8a820f0, type=Audio::Mixer::kSFXSoundType, input=0x8abc1b0,
autofreeStream=true, reverseStereo=false, id=0, permanent=false) at sound/mixer.cpp:397
#3 0x0876e16f in Audio::MixerImpl::playInputStream (this=0x8a820f0, type=Audio::Mixer::kSFXSoundType, handle=0x8a9c498,
input=0x8abc1b0, id=0, volume=78 'N', balance=0 '\0', autofreeStream=true, permanent=false, reverseStereo=false)
at sound/mixer.cpp:207
#4 0x0876e28c in Audio::MixerImpl::playRaw (this=0x8a820f0, type=Audio::Mixer::kSFXSoundType, handle=0x8a9c498,
sound=0x8b62500, size=4014, rate=10426, flags=1 '\1', id=0, volume=78 'N', balance=0 '\0', loopStart=0, loopEnd=0)
at sound/mixer.cpp:178
#5 0x085b3b45 in Sky::Sound::playSound (this=0x8a9c488, sound=6, volume=78, channel=0 '\0') at engines/sky/sound.cpp:1121
#6 0x085b3e6e in Sky::Sound::fnStartFx (this=0x8a9c488, sound=1, channel=0 '\0') at engines/sky/sound.cpp:1175
#7 0x085c6191 in Sky::Logic::fnStartFx (this=0x8b15e58, sound=257, b=0, c=127) at engines/sky/logic.cpp:2464
#8 0x085c8438 in Sky::Logic::anim (this=0x8b15e58) at engines/sky/logic.cpp:439
#9 0x085c991d in Sky::Logic::engine (this=0x8b15e58) at engines/sky/logic.cpp:160
#10 0x085b1d2a in Sky::SkyEngine::go (this=0x8aa1d08) at engines/sky/sky.cpp:207
#11 0x085b3291 in Sky::SkyEngine::run (this=0x8aa1d08) at ./engines/sky/sky.h:101
#12 0x080546bd in runGame (plugin=0x8a4f878, system=..., edebuglevels=...) at base/main.cpp:212
#13 0x08054fce in scummvm_main (argc=4, argv=0xbffff604) at base/main.cpp:377
#14 0x080519fa in main (argc=4, argv=0xbffff604) at backends/platform/sdl/main.cpp:108
(gdb)

Since outrate is 0 and ( x module 0) is undefined, it triggers the crash.

template<bool stereo, bool reverseStereo>
RateConverter *makeRateConverter(st_rate_t inrate, st_rate_t outrate)
{
if (inrate != outrate) {
if ((inrate % outrate) == 0) {
return new SimpleRateConverter<stereo,
reverseStereo>(inrate, outrate);
} else {
return new LinearRateConverter<stereo,
reverseStereo>(inrate, outrate);
}
} else {
return new CopyRateConverter<stereo, reverseStereo>();
}
}

Ticket imported from: #2872076. Ticket imported from: bugs/4636.

Change History (5)

comment:1 Changed 10 years ago by SF/jmmdebian

Priority: normallow

comment:2 Changed 10 years ago by fingolfin

Summary: Floating point exception in rate conversion if w/o soundcdMIXER: Division by 0 in rate conversion if w/o soundcd

comment:3 Changed 9 years ago by fingolfin

Fixed in trunk and branch (i.e. should be fixed in 1.1.0).

comment:4 Changed 9 years ago by fingolfin

Owner: set to fingolfin
Resolution: fixed
Status: newclosed

comment:5 Changed 6 months ago by digitall

Component: Audio
Note: See TracTickets for help on using tickets.