4a930b
From df18323c622b54221ee7ace74b177cdcccc152d7 Mon Sep 17 00:00:00 2001
4a930b
From: "Brett T. Warden" <brett.t.warden@intel.com>
4a930b
Date: Tue, 28 Aug 2018 12:01:17 -0700
4a930b
Subject: [PATCH] Check MAX_CHANNELS in sndfile-deinterleave
4a930b
4a930b
Allocated buffer has space for only 16 channels. Verify that input file
4a930b
meets this limit.
4a930b
4a930b
Fixes #397
4a930b
---
4a930b
 programs/sndfile-deinterleave.c | 7 +++++++
4a930b
 1 file changed, 7 insertions(+)
4a930b
4a930b
diff --git a/programs/sndfile-deinterleave.c b/programs/sndfile-deinterleave.c
4a930b
index 53660310..225b4d54 100644
4a930b
--- a/programs/sndfile-deinterleave.c
4a930b
+++ b/programs/sndfile-deinterleave.c
4a930b
@@ -89,6 +89,13 @@ main (int argc, char **argv)
4a930b
 		exit (1) ;
4a930b
 		} ;
4a930b
 
4a930b
+	if (sfinfo.channels > MAX_CHANNELS)
4a930b
+	{	printf ("\nError : Input file '%s' has too many (%d) channels. Limit is %d.\n",
4a930b
+			argv [1], sfinfo.channels, MAX_CHANNELS) ;
4a930b
+		exit (1) ;
4a930b
+		} ;
4a930b
+
4a930b
+
4a930b
 	state.channels = sfinfo.channels ;
4a930b
 	sfinfo.channels = 1 ;
4a930b