Fix issue of ValueError and KeyError rasied in PDFdocument and PDFparser (#574)
* check obj type * update changelog * Update CHANGELOG.md * fix the bug * fix condition * update changelog * update changelog again * update changelog * update Co-authored-by: Pieter Marsman <pietermarsman@gmail.com> Co-authored-by: Tony Tong <baojia.tong@kensho.com>pull/593/head^2
parent
ea00f56ac6
commit
543976f195
|
@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Support for Paeth PNG filter compression (predictor value = 4) ([#537](https://github.com/pdfminer/pdfminer.six/pull/537))
|
||||
|
||||
### Fixed
|
||||
- Fix issue of ValueError and KeyError rasied in PDFdocument and PDFparser ([#573](https://github.com/pdfminer/pdfminer.six/pull/574))
|
||||
- Fix issue of TypeError: cannot unpack non-iterable PDFObjRef object, when unpacking the value of 'DW2' ([#529](https://github.com/pdfminer/pdfminer.six/pull/529))
|
||||
- `PermissionError` when creating temporary filepaths on windows when running tests ([#469](https://github.com/pdfminer/pdfminer.six/issues/469))
|
||||
- Detecting trailer correctly when surrounded with needless whitespace ([#535](https://github.com/pdfminer/pdfminer.six/pull/535))
|
||||
|
|
|
@ -230,7 +230,7 @@ class PDFXRefStream(PDFBaseXRef):
|
|||
(_, kwd) = parser.nexttoken()
|
||||
(_, stream) = parser.nextobject()
|
||||
if not isinstance(stream, PDFStream) \
|
||||
or stream['Type'] is not LITERAL_XREF:
|
||||
or stream.get('Type') is not LITERAL_XREF:
|
||||
raise PDFNoValidXRef('Invalid PDF stream spec.')
|
||||
size = stream['Size']
|
||||
index_array = stream.get('Index', (0, size))
|
||||
|
|
|
@ -68,6 +68,7 @@ class PDFParser(PSStackParser):
|
|||
|
||||
elif token is self.KEYWORD_R:
|
||||
# reference to indirect object
|
||||
if len(self.curstack) >= 2:
|
||||
try:
|
||||
((_, objid), (_, genno)) = self.pop(2)
|
||||
(objid, genno) = (int(objid), int(genno))
|
||||
|
@ -75,7 +76,6 @@ class PDFParser(PSStackParser):
|
|||
self.push((pos, obj))
|
||||
except PSSyntaxError:
|
||||
pass
|
||||
|
||||
elif token is self.KEYWORD_STREAM:
|
||||
# stream object
|
||||
((_, dic),) = self.pop(1)
|
||||
|
|
Loading…
Reference in New Issue