diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-03-18 07:55:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-18 07:55:53 (GMT) |
commit | 134cb01cda50f02725575808130b05d2d776693f (patch) | |
tree | 25cf0f7f9b0404c2e9c6addc7584a24f63f64ca6 /Lib/aifc.py | |
parent | bc300ce205f99acb1ef92c37de06dc76147e073b (diff) | |
download | cpython-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.py | 4 |
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 :-( |