]> git.sesse.net Git - vlc/commit - modules/access/dshow/dshow.cpp
dshow: prevent division by zero
authorEdouard Gomez <ed.gomez@free.fr>
Tue, 14 Oct 2008 22:04:27 +0000 (00:04 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 15 Oct 2008 23:46:52 +0000 (01:46 +0200)
commit0dd04d073d5f4c653e03064273985ce51cebd43c
tree2b7e88e447ff353e13f59baa2aa2f4a4d84c860d
parentb58e4babd924f66bf2ea5c96812cdeceeb85398c
dshow: prevent division by zero

# HG changeset patch
# User Edouard Gomez <ed.gomez@free.fr>
# Date 1224021633 -7200
# Node ID 9564c1736b76c96f37fb85476d36496b3d7955bb
# Parent  40d5c2186f7fb31e944b5b542b3366bbc420cc0e
dshow: prevent division by zero

In the DShow capture module, division by zero is possible in
multiple modulo statements when dealing with granularity values
returned by capture filters.

Change the code so that:
 - if granularity is zero, then width/height/samplingrate must be
   a perfect match with requested settings.
 - if granularity is non zero, then use the old condition tests.

This fixes real crashes reported by VLC users on different forums.

See:
http://forum.doom9.org/archive/index.php/t-134655.html
http://forum.videolan.org/viewtopic.php?f=2&t=37056&p=114065&hilit=blackmagic

Tested with both a Decklink HD Extreme card and a Decklink HD Pro card.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/access/dshow/dshow.cpp