dosbox-pure
dosbox-pure copied to clipboard
Fixed unexpected crashes caused by audio
Since mixer.done and needed are declared as unsigned containers, they should be checked to avoid overflow. It was causing unexpected crashes.
Thanks you for opening this PR, before merging I need some more details about the issue.
Can you elaborate on what platform and with what kind of settings under Core Options -> Emulation Options you have a crash that is fixed with this?
As far as I understand the mixer code:
mixer.neededshould always be equal or larger thanmixer.done(seevoid MIXER_Mix(void))mixer.doneshould always be equal or larger thanreduce(see code above the submitted fix)
So it doesn't seem like it would help in any case unless you somehow are able to make these numbers wrap around which in itself would be a different problem (they are 64 bit numbers on 64 bit platforms so that seems highly unlikely).
Closing this for now.