Integer overflow in mixer add-on crashes media_addon_server
|Reported by:||jua||Owned by:||axeld|
When using an audio device with high sample rate and a BSoundPlayer with a large buffer, an integer overflow in MixerInput::BufferReceived() in the mixer.media_addon crashes the media_addon_server.
The overflow happens due to wrong casting, I'm attaching a patch which fixes it.
If you look at the line changed by the patch: when fMixBufferFrameRate is 192000 (hda chooses 192kHz as default sample rate for my onboard sound) and in_frames is 16384 (i.e. quite large buffer), the result of the multiplication is 3145728000 which is too large for int32 -- and the cast to double happens only after the multiply. The patch changes it so the cast happens before.