Module: wine Branch: master Commit: f5715f96ab78d56d25b07a59df191cc3f9cf9d60 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f5715f96ab78d56d25b07a59df...
Author: Jörg Höhle hoehle@users.sourceforge.net Date: Tue Oct 13 23:12:02 2009 +0200
imaadp32: Refine size checks.
---
dlls/imaadp32.acm/imaadp32.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/imaadp32.acm/imaadp32.c b/dlls/imaadp32.acm/imaadp32.c index 9a2fb53..4e59448 100644 --- a/dlls/imaadp32.acm/imaadp32.c +++ b/dlls/imaadp32.acm/imaadp32.c @@ -657,7 +657,6 @@ static LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) || adfs->pwfxSrc->wFormatTag == adfs->pwfxDst->wFormatTag || ADPCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; - /* FIXME: should do those tests against the real size (according to format tag */
/* If no suggestion for destination, then copy source value */ if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS)) @@ -684,12 +683,14 @@ static LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) switch (adfs->pwfxDst->wFormatTag) { case WAVE_FORMAT_PCM: + if (adfs->cbwfxSrc < sizeof(IMAADPCMWAVEFORMAT)) return ACMERR_NOTPOSSIBLE; adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8; adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign; /* check if result is ok */ if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; break; case WAVE_FORMAT_IMA_ADPCM: + if (adfs->cbwfxDst < sizeof(IMAADPCMWAVEFORMAT)) return ACMERR_NOTPOSSIBLE; init_wfx_ima_adpcm((IMAADPCMWAVEFORMAT*)adfs->pwfxDst); /* FIXME: not handling header overhead */ TRACE("setting spb=%u\n", ((IMAADPCMWAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock);