Commit 37f159e1 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

msacm32: Use a helper to validate stream pointers.

parent d4fd43c9
...@@ -50,6 +50,15 @@ static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) ...@@ -50,6 +50,15 @@ static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
return (PWINE_ACMSTREAM)has; return (PWINE_ACMSTREAM)has;
} }
static BOOL ACM_ValidatePointers(PACMDRVSTREAMHEADER padsh)
{
/* check that pointers have not been modified */
return !(padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength);
}
/*********************************************************************** /***********************************************************************
* acmStreamClose (MSACM32.@) * acmStreamClose (MSACM32.@)
*/ */
...@@ -108,13 +117,9 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, ...@@ -108,13 +117,9 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash,
*/ */
padsh = (PACMDRVSTREAMHEADER)pash; padsh = (PACMDRVSTREAMHEADER)pash;
/* check that pointers have not been modified */ if (!ACM_ValidatePointers(padsh)) {
if (padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
WARN("invalid parameter\n"); WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM; return MMSYSERR_INVALPARAM;
} }
padsh->fdwConvert = fdwConvert; padsh->fdwConvert = fdwConvert;
...@@ -467,13 +472,9 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, ...@@ -467,13 +472,9 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
*/ */
padsh = (PACMDRVSTREAMHEADER)pash; padsh = (PACMDRVSTREAMHEADER)pash;
/* check that pointers have not been modified */ if (!ACM_ValidatePointers(padsh)) {
if (padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
WARN("invalid parameter\n"); WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM; return MMSYSERR_INVALPARAM;
} }
padsh->fdwConvert = fdwUnprepare; padsh->fdwConvert = fdwUnprepare;
......
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