[PATCH] winegstreamer: Avoid zero division in amt_from_gst_caps_video().

Andrew Eikum aeikum at codeweavers.com
Tue Jan 24 08:56:05 CST 2017


Hi Masanori,

Thank you for working on this! We're late in code freeze right now,
can you please re-submit this patch after Wine 2.0 is released?

Also, it would be better to use the MulDiv function to avoid integer
overflow:

    vih->AvgTimePerFrame = (nom == 0) ? 0 : MulDiv(10000000, denom, nom);

Andrew

On Mon, Jan 23, 2017 at 10:29:19PM +0900, Masanori Kakura wrote:
> Fixes https://bugs.winehq.org/show_bug.cgi?id=42212
> 
> Signed-off-by: Masanori Kakura <kakurasan at gmail.com>
> ---
>  dlls/winegstreamer/gstdemux.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
> index c33ed9e..14ee584 100644
> --- a/dlls/winegstreamer/gstdemux.c
> +++ b/dlls/winegstreamer/gstdemux.c
> @@ -233,9 +233,7 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt)
>          bih->biCompression = amt->subtype.Data1;
>      }
>      bih->biSizeImage = width * height * bih->biBitCount / 8;
> -    vih->AvgTimePerFrame = 10000000;
> -    vih->AvgTimePerFrame *= denom;
> -    vih->AvgTimePerFrame /= nom;
> +    vih->AvgTimePerFrame = (nom == 0) ? 0 : 10000000 * denom / nom;
>      vih->rcSource.left = 0;
>      vih->rcSource.right = width;
>      vih->rcSource.top = height;
> -- 
> 2.9.3
> 
> 
> 



More information about the wine-devel mailing list