Navigation Menu

Skip to content

Commit

Permalink
music_mikmod.c: check type limits when setting md_mixfreq :
Browse files Browse the repository at this point in the history
md_mixfreq is UWORD, so it can hold up to 0xffff. therefore,
if spec->frec is greater than that, set md_mixfreq to 44100:
SDL_AudioStream should handle conversion.
  • Loading branch information
sezero committed Nov 18, 2019
1 parent d4d53a5 commit e282d0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion music_mikmod.c
Expand Up @@ -195,7 +195,7 @@ static int MIKMOD_Open(const SDL_AudioSpec *spec)
if (spec->channels > 1) {
*mikmod.md_mode |= DMODE_STEREO;
}
*mikmod.md_mixfreq = (UWORD)spec->freq;
*mikmod.md_mixfreq = (spec->freq <= 65535) ? (UWORD)spec->freq : 44100;
*mikmod.md_device = 0;
*mikmod.md_volume = 96;
*mikmod.md_musicvolume = 128;
Expand Down

0 comments on commit e282d0c

Please sign in to comment.