[vlc-commits] codec: cea708: fix possible divbyzero

Francois Cartegnie git at videolan.org
Sat Oct 21 20:56:30 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Oct 21 16:04:56 2017 +0200| [124f1ffa8057a56b0a95670d52e8c8bd9dbe1815] | committer: Francois Cartegnie

codec: cea708: fix possible divbyzero

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=124f1ffa8057a56b0a95670d52e8c8bd9dbe1815
---

 modules/codec/cea708.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/codec/cea708.c b/modules/codec/cea708.c
index 9e246207ca..19b5811787 100644
--- a/modules/codec/cea708.c
+++ b/modules/codec/cea708.c
@@ -1655,7 +1655,8 @@ static void CEA708_Decode_ServiceBuffer( cea708_t *h )
 
         /* Update internal clock */
         const uint8_t i_consumed = i_in - cea708_input_buffer_size( &h->input_buffer );
-        h->i_clock += CLOCK_FREQ / 1200 * i_consumed;
+        if( i_consumed )
+            h->i_clock += CLOCK_FREQ / 1200 * i_consumed;
     }
 }
 
@@ -1686,7 +1687,8 @@ void CEA708_Decoder_Push( cea708_t *h, mtime_t i_time,
             if ( h->suspended_deadline > h->i_clock )
             {
                 /* Increase internal clock */
-                h->i_clock += CLOCK_FREQ / 1200 * i_push;
+                if( i_push )
+                    h->i_clock += CLOCK_FREQ / 1200 * i_push;
                 continue;
             }
             h->suspended_deadline = 0;



More information about the vlc-commits mailing list