Skip to content

Commit

Permalink
Fix ValueError with unencrypted metadata values (Fixes #766). (#774)
Browse files Browse the repository at this point in the history
* Fix crash with unencrypted metadata values (#766).

* Explicitly check for length

* Update CHANGELOG.md

Co-authored-by: Pieter Marsman <pietermarsman@gmail.com>
  • Loading branch information
apollo13 and pietermarsman authored Jun 26, 2022
1 parent 1044fc0 commit f63e9fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Fixed

- `ValueError` when trying to decrypt empty metadata values ([#766](https://github.com/pdfminer/pdfminer.six/issues/766))
- Sphinx errors during building of documentation ([#760](https://github.com/pdfminer/pdfminer.six/pull/760))
- `TypeError` when getting default width of font ([#720](https://github.com/pdfminer/pdfminer.six/issues/720))

Expand Down
2 changes: 2 additions & 0 deletions pdfminer/pdftypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def resolve_all(x: object, default: object = None) -> Any:
def decipher_all(decipher: DecipherCallable, objid: int, genno: int, x: object) -> Any:
"""Recursively deciphers the given object."""
if isinstance(x, bytes):
if len(x) == 0:
return x
return decipher(objid, genno, x)
if isinstance(x, list):
x = [decipher_all(decipher, objid, genno, v) for v in x]
Expand Down

0 comments on commit f63e9fb

Please sign in to comment.