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))
|
- Support for Paeth PNG filter compression (predictor value = 4) ([#537](https://github.com/pdfminer/pdfminer.six/pull/537))
|
||||||
|
|
||||||
### Fixed
|
### 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))
|
- 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))
|
- `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))
|
- 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()
|
(_, kwd) = parser.nexttoken()
|
||||||
(_, stream) = parser.nextobject()
|
(_, stream) = parser.nextobject()
|
||||||
if not isinstance(stream, PDFStream) \
|
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.')
|
raise PDFNoValidXRef('Invalid PDF stream spec.')
|
||||||
size = stream['Size']
|
size = stream['Size']
|
||||||
index_array = stream.get('Index', (0, size))
|
index_array = stream.get('Index', (0, size))
|
||||||
|
|
|
@ -68,14 +68,14 @@ class PDFParser(PSStackParser):
|
||||||
|
|
||||||
elif token is self.KEYWORD_R:
|
elif token is self.KEYWORD_R:
|
||||||
# reference to indirect object
|
# reference to indirect object
|
||||||
try:
|
if len(self.curstack) >= 2:
|
||||||
((_, objid), (_, genno)) = self.pop(2)
|
try:
|
||||||
(objid, genno) = (int(objid), int(genno))
|
((_, objid), (_, genno)) = self.pop(2)
|
||||||
obj = PDFObjRef(self.doc, objid, genno)
|
(objid, genno) = (int(objid), int(genno))
|
||||||
self.push((pos, obj))
|
obj = PDFObjRef(self.doc, objid, genno)
|
||||||
except PSSyntaxError:
|
self.push((pos, obj))
|
||||||
pass
|
except PSSyntaxError:
|
||||||
|
pass
|
||||||
elif token is self.KEYWORD_STREAM:
|
elif token is self.KEYWORD_STREAM:
|
||||||
# stream object
|
# stream object
|
||||||
((_, dic),) = self.pop(1)
|
((_, dic),) = self.pop(1)
|
||||||
|
|
Loading…
Reference in New Issue