summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/double64.c7
-rw-r--r--src/float32.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/double64.c b/src/double64.c
index ce60699..b318ea8 100644
--- a/src/double64.c
+++ b/src/double64.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
@@ -91,6 +91,11 @@ int
double64_init (SF_PRIVATE *psf)
{ static int double64_caps ;
+ if (psf->sf.channels < 1)
+ { psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
+ return SFE_INTERNAL ;
+ } ;
+
double64_caps = double64_get_capability (psf) ;
psf->blockwidth = sizeof (double) * psf->sf.channels ;
diff --git a/src/float32.c b/src/float32.c
index 89bcf6b..100c149 100644
--- a/src/float32.c
+++ b/src/float32.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
@@ -88,6 +88,11 @@ int
float32_init (SF_PRIVATE *psf)
{ static int float_caps ;
+ if (psf->sf.channels < 1)
+ { psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
+ return SFE_INTERNAL ;
+ } ;
+
float_caps = float32_get_capability (psf) ;
psf->blockwidth = sizeof (float) * psf->sf.channels ;