Bug Report
In src_c/mixer.c, the chan_play function does not check whether channelnum is -1 after calling Mix_PlayChannelTimed or Mix_FadeInChannelTimed before indexing into channeldata. If either SDL mixer call fails and returns -1, the subsequent code dereferences channeldata[-1], which is out-of-bounds and can corrupt memory.
Affected code
src_c/mixer.c — chan_play function, around the block:
Py_XDECREF(channeldata[channelnum].sound);
Py_XDECREF(channeldata[channelnum].queue);
channeldata[channelnum].sound = Py_NewRef(sound);
channeldata[channelnum].queue = NULL;
A guard checking channelnum != -1 (raising an SDL error when -1) is missing here, similar to the guard already present in pgSound_Play.
References
Bug Report
In
src_c/mixer.c, thechan_playfunction does not check whetherchannelnumis-1after callingMix_PlayChannelTimedorMix_FadeInChannelTimedbefore indexing intochanneldata. If either SDL mixer call fails and returns-1, the subsequent code dereferenceschanneldata[-1], which is out-of-bounds and can corrupt memory.Affected code
src_c/mixer.c—chan_playfunction, around the block:A guard checking
channelnum != -1(raising an SDL error when-1) is missing here, similar to the guard already present inpgSound_Play.References