[MPlayer-cvslog] r37642 - trunk/libmpdemux/demux_avi.c

reimar subversion at mplayerhq.hu
Tue Feb 9 22:20:54 CET 2016


Author: reimar
Date: Tue Feb  9 22:20:54 2016
New Revision: 37642

Log:
demux_avi: Avoid potential division by 0.

Avoids Coverity warnings.

Modified:
   trunk/libmpdemux/demux_avi.c

Modified: trunk/libmpdemux/demux_avi.c
==============================================================================
--- trunk/libmpdemux/demux_avi.c	Tue Feb  9 22:13:26 2016	(r37641)
+++ trunk/libmpdemux/demux_avi.c	Tue Feb  9 22:20:54 2016	(r37642)
@@ -575,8 +575,8 @@ static demuxer_t* demux_open_avi(demuxer
            "AVI video size=%"PRId64" (%zu) audio size=%"PRId64" (%zu)\n",
            vsize, vsamples, asize, asamples);
     priv->numberofframes=vsamples;
-    sh_video->i_bps=((float)vsize/(float)vsamples)*(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
-    if(sh_audio) sh_audio->i_bps=((float)asize/(float)asamples)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
+    if (vsamples) sh_video->i_bps=((float)vsize/(float)vsamples)*(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
+    if(sh_audio && asamples) sh_audio->i_bps=((float)asize/(float)asamples)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
   } else {
     // guessing, results may be inaccurate:
     int64_t vsize;


More information about the MPlayer-cvslog mailing list