summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/aifc.py1
-rw-r--r--Lib/test/test_aifc.py8
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py
index e51e8f8..3d2dc56 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -322,6 +322,7 @@ class Aifc_read:
else:
raise Error('not an AIFF or AIFF-C file')
self._comm_chunk_read = 0
+ self._ssnd_chunk = None
while 1:
self._ssnd_seek_needed = 1
try:
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index a064a32..8fd306a 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -266,6 +266,14 @@ class AIFCLowLevelTest(unittest.TestCase):
b = io.BytesIO(b'FORM' + struct.pack('>L', 4) + b'AIFF')
self.assertRaises(aifc.Error, aifc.open, b)
+ def test_read_no_ssnd_chunk(self):
+ b = b'FORM' + struct.pack('>L', 4) + b'AIFC'
+ b += b'COMM' + struct.pack('>LhlhhLL', 38, 0, 0, 0, 0, 0, 0)
+ b += b'NONE' + struct.pack('B', 14) + b'not compressed' + b'\x00'
+ with self.assertRaisesRegex(aifc.Error, 'COMM chunk and/or SSND chunk'
+ ' missing'):
+ aifc.open(io.BytesIO(b))
+
def test_read_wrong_compression_type(self):
b = b'FORM' + struct.pack('>L', 4) + b'AIFC'
b += b'COMM' + struct.pack('>LhlhhLL', 23, 0, 0, 0, 0, 0, 0)