shithub: sox

Download patch

ref: 4f84d61880d5d88753897dc1539e1f9aa66dfe7a
parent: 38f670fa005634b12ae0dbdc47acb300fd526788
author: Mans Rullgard <mans@mansr.com>
date: Sat Aug 8 11:27:09 EDT 2020

formats: reject negative sample rate [bug #333]

Negative sample rate makes no sense and causes problems.

--- a/src/formats.c
+++ b/src/formats.c
@@ -345,8 +345,8 @@
 {
   ft->sox_errno = SOX_SUCCESS;
 
-  if (!ft->signal.rate) {
-    lsx_fail_errno(ft,SOX_EFMT,"sampling rate was not specified");
+  if (ft->signal.rate <= 0) {
+    lsx_fail_errno(ft, SOX_EFMT, "sample rate zero or negative");
     return SOX_EOF;
   }
   if (!ft->signal.precision) {