[xiph-commits] r14187 - trunk/vorbis-tools/ogg123

ivo at svn.xiph.org ivo at svn.xiph.org
Mon Nov 19 06:45:08 PST 2007


Author: ivo
Date: 2007-11-19 06:45:07 -0800 (Mon, 19 Nov 2007)
New Revision: 14187

Modified:
   trunk/vorbis-tools/ogg123/flac_format.c
Log:
committed debian patch to fix a floating-point exception when trying to play a corrupt FLAC file.  closes ticket #1119

Modified: trunk/vorbis-tools/ogg123/flac_format.c
===================================================================
--- trunk/vorbis-tools/ogg123/flac_format.c	2007-11-19 13:16:03 UTC (rev 14186)
+++ trunk/vorbis-tools/ogg123/flac_format.c	2007-11-19 14:45:07 UTC (rev 14187)
@@ -274,6 +274,11 @@
 
   *audio_fmt = decoder->actual_fmt;
 
+  /* Validate channels and word_size to avoid div by zero */
+  if(!(audio_fmt->channels && audio_fmt->word_size)) {
+    fprintf(stderr, _("Error: Corrupt input.\n"));
+    exit(1);
+  }
 
   /* Only return whole samples (no channel splitting) */
   samples = nbytes / (audio_fmt->channels * audio_fmt->word_size);
@@ -282,7 +287,7 @@
     if (priv->buf_fill > 0) {
       int copy = priv->buf_fill < (samples - realsamples) ?
 	priv->buf_fill : (samples - realsamples);
-      
+
       /* Need sample mangling code here! */
 
       if (audio_fmt->word_size == 1) {



More information about the commits mailing list