olefile icon indicating copy to clipboard operation
olefile copied to clipboard

Change from catching BaseException to Exception.

Open TheElementalOfDestruction opened this issue 1 year ago • 0 comments

olefile version 0.46 and 0.47.dev4 (master branch)

I've noticed that a number of the try-except blocks are specifically catching BaseException instead of Exception, which could lead to strange issues of exceptions being silenced where they should not (for example, KeyboardInterrupt and SystemExit). Looking through the code it appears that all of the exceptions raised (the ones that should be caught) will be subclasses of Exception and not BaseException, so there is no immediately obvious reason to catch BaseException instead.

These sections are overall so short that this issue coming up should be rare, but it does still appear to be possible.

These catches can be seen on lines 2163, 2185, 2502, and 2509 of olefile.py on the master branch.