Commit 349abe99 authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

dsound: Fix off by 1 heap error in DSOUND_MixerVol.

parent 3d5ea201
...@@ -469,7 +469,7 @@ static LPBYTE DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT len) ...@@ -469,7 +469,7 @@ static LPBYTE DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT len)
case 8: case 8:
/* 8-bit WAV is unsigned, but we need to operate */ /* 8-bit WAV is unsigned, but we need to operate */
/* on signed data for this to work properly */ /* on signed data for this to work properly */
for (i = 0; i < len; i+=2) { for (i = 0; i < len-1; i+=2) {
*(bpc++) = (((*(mem++) - 128) * vLeft) >> 16) + 128; *(bpc++) = (((*(mem++) - 128) * vLeft) >> 16) + 128;
*(bpc++) = (((*(mem++) - 128) * vRight) >> 16) + 128; *(bpc++) = (((*(mem++) - 128) * vRight) >> 16) + 128;
} }
...@@ -478,7 +478,7 @@ static LPBYTE DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT len) ...@@ -478,7 +478,7 @@ static LPBYTE DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT len)
break; break;
case 16: case 16:
/* 16-bit WAV is signed -- much better */ /* 16-bit WAV is signed -- much better */
for (i = 0; i < len; i += 4) { for (i = 0; i < len-3; i += 4) {
*(bps++) = (*(mems++) * vLeft) >> 16; *(bps++) = (*(mems++) * vLeft) >> 16;
*(bps++) = (*(mems++) * vRight) >> 16; *(bps++) = (*(mems++) * vRight) >> 16;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment