[PATCH 02/12] msacm32: Add invalid parameter checks for acmFormatDetails().

Andrew Eikum aeikum at codeweavers.com
Wed Jun 7 09:02:57 CDT 2017


On Tue, Jun 06, 2017 at 03:14:51PM -0500, Zebediah Figura wrote:
> @@ -376,10 +377,13 @@ MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd,
>      ACMFORMATDETAILSW	afdw;
>      MMRESULT		mmr;
>  
> -    memset(&afdw, 0, sizeof(afdw));
> +    if (!pafd)
> +        return MMSYSERR_INVALPARAM;
> +
>      afdw.cbStruct = sizeof(afdw);
>      afdw.dwFormatIndex = pafd->dwFormatIndex;
>      afdw.dwFormatTag = pafd->dwFormatTag;
> +    afdw.fdwSupport = pafd->fdwSupport;
>      afdw.pwfx = pafd->pwfx;
>      afdw.cbwfx = pafd->cbwfx;
>  

Like before, is there a reason to no longer zero this struct?

> @@ -430,7 +447,14 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
>  	}
>  	break;
>      case ACM_FORMATDETAILSF_INDEX:
> -	/* should check pafd->dwFormatIndex < aftd->cStandardFormats */
> +        aftd.cbStruct = sizeof(aftd);
> +        aftd.dwFormatTag = pafd->dwFormatTag;
> +        acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_FORMATTAG);
> +        if (pafd->dwFormatIndex >= aftd.cStandardFormats)
> +        {
> +            mmr = MMSYSERR_INVALPARAM;
> +            break;
> +        }

Please add error checking for acmFormatTagDetailsW.

The next two patches in the sequence fail on the test bot, so I
stopped reviewing here. It's common for APIs to return different error
codes on different Windows versions, so you likely just need to accept
either code in your ok() checks.

Andrew



More information about the wine-devel mailing list