summaryrefslogtreecommitdiffstats
path: root/Lib/aifc.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-03-18 07:55:53 (GMT)
committerGitHub <noreply@github.com>2018-03-18 07:55:53 (GMT)
commit134cb01cda50f02725575808130b05d2d776693f (patch)
tree25cf0f7f9b0404c2e9c6addc7584a24f63f64ca6 /Lib/aifc.py
parentbc300ce205f99acb1ef92c37de06dc76147e073b (diff)
downloadcpython-134cb01cda50f02725575808130b05d2d776693f.zip
cpython-134cb01cda50f02725575808130b05d2d776693f.tar.gz
cpython-134cb01cda50f02725575808130b05d2d776693f.tar.bz2
bpo-32056: Improve exceptions in aifc, wave and sunau. (GH-5951)
Diffstat (limited to 'Lib/aifc.py')
-rw-r--r--Lib/aifc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py
index 3d2dc56..1916e7e 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -467,6 +467,10 @@ class Aifc_read:
self._nframes = _read_long(chunk)
self._sampwidth = (_read_short(chunk) + 7) // 8
self._framerate = int(_read_float(chunk))
+ if self._sampwidth <= 0:
+ raise Error('bad sample width')
+ if self._nchannels <= 0:
+ raise Error('bad # of channels')
self._framesize = self._nchannels * self._sampwidth
if self._aifc:
#DEBUG: SGI's soundeditor produces a bad size :-(