Module: wine
Branch: master
Commit: 349abe991ee50dedf16f6f65f556cbd308cf3929
URL: http://source.winehq.org/git/wine.git/?a=commit;h=349abe991ee50dedf16f6f65f…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net>
Date: Tue May 20 18:15:15 2008 +0200
dsound: Fix off by 1 heap error in DSOUND_MixerVol.
---
dlls/dsound/mixer.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index 3d3741b..7ac6e67 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -469,7 +469,7 @@ static LPBYTE DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT len)
case 8:
/* 8-bit WAV is unsigned, but we need to operate */
/* 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) * vRight) >> 16) + 128;
}
@@ -478,7 +478,7 @@ static LPBYTE DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT len)
break;
case 16:
/* 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++) * vRight) >> 16;
}