summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2015-02-09 18:13:30 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2015-02-09 18:14:36 +1100
commit0f8c22bfa848d3dfb3258399e9256de00b23f130 (patch)
tree13a869448c92dec802c49330a39edd6854c35ac4
parentc49a1374b7c1831bbe5742d4e091eb50460c90bb (diff)
src/au.c : Validate channel count.
-rw-r--r--src/au.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/au.c b/src/au.c
index bcd869a..7f76826 100644
--- a/src/au.c
+++ b/src/au.c
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2015 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@@ -437,8 +437,12 @@ au_read_header (SF_PRIVATE *psf)
{ psf_log_printf (psf, " Channels : %d **** should be >= 1\n", au_fmt.channels) ;
return SFE_CHANNEL_COUNT_ZERO ;
}
- else
- psf_log_printf (psf, " Channels : %d\n", au_fmt.channels) ;
+ else if (au_fmt.channels > SF_MAX_CHANNELS)
+ { psf_log_printf (psf, " Channels : %d **** should be <= %d\n", au_fmt.channels, SF_MAX_CHANNELS) ;
+ return SFE_CHANNEL_COUNT ;
+ } ;
+
+ psf_log_printf (psf, " Channels : %d\n", au_fmt.channels) ;
psf->blockwidth = psf->sf.channels * psf->bytewidth ;