bpo-32056: Improve exceptions in aifc, wave and sunau. (GH-5951)

This commit is contained in:
Serhiy Storchaka 2018-03-18 09:55:53 +02:00 committed by GitHub
parent bc300ce205
commit 134cb01cda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 150 additions and 7 deletions

View file

@ -208,6 +208,8 @@ class Au_read:
raise Error('unknown encoding')
self._framerate = int(_read_u32(file))
self._nchannels = int(_read_u32(file))
if not self._nchannels:
raise Error('bad # of channels')
self._framesize = self._framesize * self._nchannels
if self._hdr_size > 24:
self._info = file.read(self._hdr_size - 24)