Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log warning and continue gracefully if errors in cmap #731

Merged
merged 8 commits into from
Mar 21, 2022

Conversation

pietermarsman
Copy link
Member

@pietermarsman pietermarsman commented Mar 19, 2022

Pull request

Log warning and gracefully ignore errors in CMaps.

Fixes #218 by skipping assigning cid's in a "bfrange" if the difference between srcCode1 and srcCode2 is bigger than the dstString.

PDF Reference Section 5.9.2

image

How Has This Been Tested?

On both anomaly PDF's from issue #218.

Checklist

  • I have formatted my code with black.
  • I have added tests that prove my fix is effective or that my feature
    works
  • I have added docstrings to newly created methods and classes
  • I have optimized the code at least one time after creating the initial
    version
  • I have updated the README.md or verified that this
    is not necessary
  • I have updated the readthedocs documentation or
    verified that this is not necessary
  • I have added a concise human-readable description of the change to
    CHANGELOG.md

Copy link
Member

@jstockwin jstockwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, but looks good otherwise so will approve and leave it to you 👍

pdfminer/cmapdb.py Show resolved Hide resolved
@pietermarsman pietermarsman merged commit 894dabf into master Mar 21, 2022
@pietermarsman pietermarsman deleted the 218-fix-beginbfrange branch March 21, 2022 18:39
Beants added a commit to HiTalentAlgorithms/pdfminer.six that referenced this pull request Apr 26, 2022
* commit '1bf3c42b59125f4491d863e1c11dca7ebbe96adc':
  Use charset-normalizer instead of chardet (pdfminer#744)
  Refactor ImageWriter and add method for exporting an image from bytes. (pdfminer#737)
  Log warning and continue gracefully if errors in cmap (pdfminer#731)
  Fix log.debug statement in lzw.py by ensuring that self.table is always set (pdfminer#732)
  Raise KeyError when name in name2unicode is not of type str (pdfminer#733)
  Convert fontname to str if it is bytes in HTMLConverter (pdfminer#734)
  Fix github actions tag regex
  Fix github actions tag regex
  Bump version
  Add github action for releasing to pypi if git tag is added. (pdfminer#727)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list index out of range at self.cmap.add_cid2unichr(s1+i, code[i])
2 participants