Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

fixes two issues found in malformed PDFs #186

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pdfminer/pdfpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, doc, pageid, attrs):
self.attrs = dict_value(attrs)
self.lastmod = resolve1(self.attrs.get('LastModified'))
self.resources = resolve1(self.attrs.get('Resources', dict()))
self.mediabox = resolve1(self.attrs['MediaBox'])
self.mediabox = resolve1(self.attrs.get('MediaBox', (0,0,0,0)))
if 'CropBox' in self.attrs:
self.cropbox = resolve1(self.attrs['CropBox'])
else:
Expand Down
2 changes: 2 additions & 0 deletions pdfminer/pdftypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ def decode(self):
else:
raise PDFNotImplementedError('Unsupported filter: %r' % f)
# apply predictors
if not params:
continue
if 'Predictor' in params:
pred = int_value(params['Predictor'])
if pred == 1:
Expand Down