msacm32: Use a helper to validate stream pointers.
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d4fd43c971
commit
37f159e1cb
|
@ -50,6 +50,15 @@ static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM 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.@)
|
||||
*/
|
||||
|
@ -108,11 +117,7 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash,
|
|||
*/
|
||||
padsh = (PACMDRVSTREAMHEADER)pash;
|
||||
|
||||
/* check that pointers have not been modified */
|
||||
if (padsh->pbPreparedSrc != padsh->pbSrc ||
|
||||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
|
||||
padsh->pbPreparedDst != padsh->pbDst ||
|
||||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
|
||||
if (!ACM_ValidatePointers(padsh)) {
|
||||
WARN("invalid parameter\n");
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
@ -467,11 +472,7 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
|
|||
*/
|
||||
padsh = (PACMDRVSTREAMHEADER)pash;
|
||||
|
||||
/* check that pointers have not been modified */
|
||||
if (padsh->pbPreparedSrc != padsh->pbSrc ||
|
||||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
|
||||
padsh->pbPreparedDst != padsh->pbDst ||
|
||||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
|
||||
if (!ACM_ValidatePointers(padsh)) {
|
||||
WARN("invalid parameter\n");
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue