[PATCH] msacm32: Correctly allocate WAVEFORMATEX.

Andrew Eikum aeikum at codeweavers.com
Thu Jun 1 10:26:34 CDT 2017


This doesn't look right to me. According to MSDN[1], the cbFormatSize
field should already be the full size of the format struct. It's
possible MSDN is wrong, but we'd need tests to prove that first.

Who sets cbFormatSize? Could the error be there?

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/dd742918(v=vs.85).aspx

Andrew

On Wed, May 31, 2017 at 06:03:58PM -0500, Zebediah Figura wrote:
> Fixes https://bugs.winehq.org/show_bug.cgi?id=26388
> 
> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
> ---
>  dlls/msacm32/format.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dlls/msacm32/format.c b/dlls/msacm32/format.c
> index de07cba9a3..ec46cae163 100644
> --- a/dlls/msacm32/format.c
> +++ b/dlls/msacm32/format.c
> @@ -75,7 +75,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
>  
>  		afd.cbStruct = sizeof(afd);
>  		afd.dwFormatTag = paftd->dwFormatTag;
> -		afd.pwfx = HeapAlloc(MSACM_hHeap, 0, paftd->cbFormatSize);
> +		afd.pwfx = HeapAlloc(MSACM_hHeap, 0, sizeof(WAVEFORMATEX) + paftd->cbFormatSize);
>  		if (!afd.pwfx) return FALSE;
>  		afd.pwfx->wFormatTag = paftd->dwFormatTag;
>  		afd.pwfx->cbSize = paftd->cbFormatSize;
> -- 
> 2.13.0
> 
> 
> 



More information about the wine-devel mailing list