[issue32056] Improve exceptions in aifc, sunau and wave

Serhiy Storchaka report at bugs.python.org
Sun Mar 18 05:16:54 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Now open() in modules aifc, sunau and wave will raise only EOFError (if the file was truncated) or corresponding module error exception on corrupted files. aifc.open() can raise also OverflowError, but this is a different issue32978. And of course OSError, MemoryError, RecursionError and KeyboardInterrupt can be raised for causes not related to the correctness of the file.

I withdraw the part of my claim in msg313084. I have tested -- backporting this is safe, because some error always was raised in open(). But it can help existing user code which was not aware about wider set of exceptions (like in the original report). It can work in common case, and handle most corrupted files well, but fail in cases of specially created malicious data. Thus I think it is worth to backport this change at least to 3.7. What are your thoughts Ned?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32056>
_______________________________________


More information about the Python-bugs-list mailing list