shithub: sox

Download patch

ref: 8131c24b679175a8a10ab4fd39be766c4625ab4a
parent: 184d25cd61f3a0f049bce39ec1c99930613e6e92
author: Rob Sykes <robs@users.sourceforge.net>
date: Thu Aug 2 15:28:11 EDT 2012

prevent SIGFPE from inf * 10

--- a/src/sox.c
+++ b/src/sox.c
@@ -1242,11 +1242,13 @@
 
 static char * headroom(void)
 {
-  static char buff[10];
-  unsigned h = (unsigned)(min_headroom * 10);
-  if (min_headroom >= MIN_HEADROOM) return "      ";
-  sprintf(buff, "Hd:%u.%u", h /10, h % 10);
-  return buff;
+  if (min_headroom < MIN_HEADROOM) {
+    static char buff[10];
+    unsigned h = (unsigned)(min_headroom * 10);
+    sprintf(buff, "Hd:%u.%u", h /10, h % 10);
+    return buff;
+  }
+  return "      ";
 }
 
 static void display_status(sox_bool all_done)