shithub: sox

Download patch

ref: b765d62d950a1da15358b1ed6e1ff1b1ff015548
parent: 5cb0ea04bbd1c00b2fffd7fe721f00200b2d41d3
author: cbagwell <cbagwell>
date: Wed Nov 30 20:14:31 EST 2005

Add extra error checking for 4-channel swapping.

--- a/src/swap.c
+++ b/src/swap.c
@@ -103,7 +103,13 @@
             swap->order[3] = 3;
         }
 
-        if (!swap->order[2] && !swap->order[3])
+        if (swap->order[0] < 1 || swap->order[0] > 4)
+            st_fail("invalid swap channel options used");
+        if (swap->order[1] < 1 || swap->order[1] > 4)
+            st_fail("invalid swap channel options used");
+        if (swap->order[2] < 1 || swap->order[2] > 4)
+            st_fail("invalid swap channel options used");
+        if (swap->order[3] < 1 || swap->order[3] > 4)
             st_fail("invalid swap channel options used");
 
         /* Convert to array offsets */