[Scummvm-tracker] [ScummVM :: Bugs] #13908: SCUMM: INDY3 (MAC): ASAN crash in Player_V2Base::next_freqs() in Castle Brunwald

ScummVM :: Bugs trac at scummvm.org
Sun Nov 19 09:50:19 UTC 2023


#13908: SCUMM: INDY3 (MAC): ASAN crash in Player_V2Base::next_freqs() in Castle
Brunwald
-------------------------------------------------+-------------------------
Reporter:  dwatteau                              |       Owner:  (none)
    Type:  defect                                |      Status:  new
Priority:  high                                  |   Component:  Engine:
                                                 |  SCUMM
 Version:                                        |  Resolution:
Keywords:  asan,crash,castle brunwald,macintosh  |        Game:  Indiana
                                                 |  Jones 3
-------------------------------------------------+-------------------------
Comment (by eriktorbjorn):

 The highest index I recorded when not using ASAN was where freqmod_table
 was 512 and freqmod_offset was 65424, giving an offset of 4601. That's not
 just a little outside.

 From what I understand, freqmod_table is set from from freqmod_offsets[],
 while freqmod_offset starts out at 0, is modified by freqmod_incr, and
 capped by freqmod_modulo.

 In this case, freqmod_incr is 300 and freqmod_modulo is 32.

 Which means that there is no chance that freqmod_modulo will be able to
 keep up:

 {{{
         channel->d.freqmod_offset += channel->d.freqmod_incr;
         if (channel->d.freqmod_offset > channel->d.freqmod_modulo)
                 channel->d.freqmod_offset -= channel->d.freqmod_modulo;
 }}}

 Perhaps this should be changed to

 {{{
         channel->d.freqmod_offset += channel->d.freqmod_incr;
         if (channel->d.freqmod_offset > channel->d.freqmod_modulo)
                 channel->d.freqmod_offset -= channel->d.freqmod_modulo;
 }}}

 or simply

 {{{
         channel->d.freqmod_offset = (channel->d.freqmod_offset +
 channel->d.freqmod_incr) % channel->d.freqmod_modulo;
 }}}

 instead?
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/13908#comment:7>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list