Skip to content

Fix bare except clauses in pdfrw/pdfreader.py - #256

Open
koteshyelamati wants to merge 1 commit into
pmaupin:masterfrom
koteshyelamati:master
Open

Fix bare except clauses in pdfrw/pdfreader.py#256
koteshyelamati wants to merge 1 commit into
pmaupin:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Replace 2 bare except: clauses with except Exception: in the xref table parser.

Both handlers are in malformed-PDF recovery paths: one silently ignores xref entry parse errors and the other resets the file position after a bad xref table. Bare except: catches BaseException (including KeyboardInterrupt and SystemExit), which could suppress signals during PDF reading. except Exception: is the correct specific type for these recovery blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant