Skip to content

Commit

Permalink
fix: a couple of invalid PDF fuzz cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Sep 19, 2024
1 parent 1bb4cae commit 4c7d494
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pdfminer/pdfparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ def flush(self) -> None:
def do_keyword(self, pos: int, token: PSKeyword) -> None:
if token is self.KEYWORD_R:
# reference to indirect object
(_, _object_id), _ = self.pop(2)
try:
(_, _object_id), _ = self.pop(2)
except ValueError:
raise PDFSyntaxError(
"Expected generation and object id in indirect object reference"
)
object_id = safe_int(_object_id)
if object_id is not None:
obj = PDFObjRef(self.doc, object_id)
Expand Down
2 changes: 1 addition & 1 deletion pdfminer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def parse_rect(o: Any) -> Rect:
try:
(x0, y0, x1, y1) = o
return float(x0), float(y0), float(x1), float(y1)
except ValueError:
except (ValueError, TypeError):
raise PDFValueError("Could not parse rectangle")


Expand Down

0 comments on commit 4c7d494

Please sign in to comment.