MSACM: return failure rather than assert with nAvgBytesPerSec == 0

Alex Villací­s Lasso a_villacis at palosanto.com
Mon Jan 16 11:26:40 CST 2006


Alex Villací­s Lasso wrote:

> This check is necessary until local codec loading is in CVS. Failure 
> scenario fixed is: app instructs to load local ACM codec, fails, 
> doesn't notice failure, requests codec info, fails, again doesn't 
> notice failure, submits zeroed structure to PCM converter --> 
> assertion failed.
>
> Changelog:
> * Check for nAvgBytesPerSec == 0 in PCM converter instead of allowing 
> assertion to fail.
>
> Alex Villacís Lasso
>
>------------------------------------------------------------------------
>
>--- wine-0.9.5-cvs/dlls/msacm/pcmconverter.c	2005-11-28 15:57:25.000000000 -0500
>+++ wine-0.9.5-cvs-patch/dlls/msacm/pcmconverter.c	2006-01-09 21:17:07.000000000 -0500
>@@ -945,12 +945,20 @@
>     switch (adss->fdwSize) {
>     case ACM_STREAMSIZEF_DESTINATION:
> 	/* cbDstLength => cbSrcLength */
>+	if (!adsi->pwfxDst->nAvgBytesPerSec) {
>+	    ERR("adsi->pwfxDst->nAvgBytesPerSec == %lu\n", adsi->pwfxDst->nAvgBytesPerSec);
>+	    return MMSYSERR_INVALPARAM;
>+	}
> 	adss->cbSrcLength = PCM_round(adss->cbDstLength & dstMask,
> 				      adsi->pwfxSrc->nAvgBytesPerSec,
> 				      adsi->pwfxDst->nAvgBytesPerSec) & srcMask;
> 	break;
>     case ACM_STREAMSIZEF_SOURCE:
> 	/* cbSrcLength => cbDstLength */
>+	if (!adsi->pwfxSrc->nAvgBytesPerSec) {
>+	    ERR("adsi->pwfxSrc->nAvgBytesPerSec == %lu\n", adsi->pwfxSrc->nAvgBytesPerSec);
>+	    return MMSYSERR_INVALPARAM;
>+	}
> 	adss->cbDstLength =  PCM_round(adss->cbSrcLength & srcMask,
> 				       adsi->pwfxDst->nAvgBytesPerSec,
> 				       adsi->pwfxSrc->nAvgBytesPerSec) & dstMask;
>  
>
>------------------------------------------------------------------------
>
>
>  
>
Any comment on this patch?

Alex Villacís Lasso




More information about the wine-devel mailing list