[Python-checkins] r46539 - python/trunk/Lib/aifc.py

bob.ippolito python-checkins at python.org
Tue May 30 02:26:01 CEST 2006


Author: bob.ippolito
Date: Tue May 30 02:26:01 2006
New Revision: 46539

Modified:
   python/trunk/Lib/aifc.py
Log:
Add a length check to aifc to ensure it doesn't write a bogus file

Modified: python/trunk/Lib/aifc.py
==============================================================================
--- python/trunk/Lib/aifc.py	(original)
+++ python/trunk/Lib/aifc.py	Tue May 30 02:26:01 2006
@@ -201,6 +201,8 @@
     f.write(struct.pack('>L', x))
 
 def _write_string(f, s):
+    if len(s) > 255:
+        raise ValueError("string exceeds maximum pstring length")
     f.write(chr(len(s)))
     f.write(s)
     if len(s) & 1 == 0:


More information about the Python-checkins mailing list