[PATCH 01/12] msacm32: Add more invalid parameter checks for acmFormatEnum().

Andrew Eikum aeikum at codeweavers.com
Wed Jun 7 08:43:28 CDT 2017


In the future, please limit patch sequences to about four patches.
It's much easier to review and iterate on smaller sequences.

Looks mostly good, a couple small comments in-line below.

On Tue, Jun 06, 2017 at 03:14:50PM -0500, Zebediah Figura wrote:
> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
> ---
>  dlls/msacm32/format.c      | 19 ++++++++++++++++++-
>  dlls/msacm32/tests/msacm.c | 36 ++++++++++++++++++++++++++++++++----
>  2 files changed, 50 insertions(+), 5 deletions(-)
> 
> diff --git a/dlls/msacm32/format.c b/dlls/msacm32/format.c
> index 3f3ee5492d..70fe9f0d1b 100644
> --- a/dlls/msacm32/format.c
> +++ b/dlls/msacm32/format.c
> @@ -492,13 +492,16 @@ MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda,
>      if (!pafda)
>          return MMSYSERR_INVALPARAM;
>  
> +    if (!fnCallback)
> +        return MMSYSERR_INVALPARAM;
> +
>      if (pafda->cbStruct < sizeof(*pafda))
>          return MMSYSERR_INVALPARAM;
>  
> -    memset(&afdw, 0, sizeof(afdw));
>      afdw.cbStruct = sizeof(afdw);
>      afdw.dwFormatIndex = pafda->dwFormatIndex;
>      afdw.dwFormatTag = pafda->dwFormatTag;
> +    afdw.fdwSupport = pafda->fdwSupport;
>      afdw.pwfx = pafda->pwfx;
>      afdw.cbwfx = pafda->cbwfx;
>  

This no longer initializes the szFormat member. Unless there's a
compelling reason not to initialize it, I'd rather continue to do so
in case it doesn't get filled during acmFormatDetails.

> @@ -639,6 +652,10 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd,
>      if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))
>  	FIXME("Unsupported fdwEnum values %08x\n", fdwEnum);
>  
> +    acmMetrics((HACMOBJ)had, ACM_METRIC_MAX_SIZE_FORMAT, &cbwfxMax);
> +    if (pafd->cbwfx < cbwfxMax)
> +        return MMSYSERR_INVALPARAM;
> +

Please add error checking here.

Andrew



More information about the wine-devel mailing list