Kaydet (Commit) 6067f201 authored tarafından Bob Ippolito's avatar Bob Ippolito

Add a length check to aifc to ensure it doesn't write a bogus file

üst 2fd3977a
...@@ -201,6 +201,8 @@ def _write_long(f, x): ...@@ -201,6 +201,8 @@ def _write_long(f, x):
f.write(struct.pack('>L', x)) f.write(struct.pack('>L', x))
def _write_string(f, s): def _write_string(f, s):
if len(s) > 255:
raise ValueError("string exceeds maximum pstring length")
f.write(chr(len(s))) f.write(chr(len(s)))
f.write(s) f.write(s)
if len(s) & 1 == 0: if len(s) & 1 == 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment