Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PyMuPDF issue 2608: CMAP mrange with surrogate chars.
The file given in the bug contains a CMAP with a bfrange entry: <63> <73> <D835DF08> i.e. a range where the code 'base' is given as a surrogate pair. We parse this, and because the base definition is longer than the single 16 bit value, we break the range down into a series of single char ranges. We add these single char ranges (using pdf_map_one_to_many) incrementing the last value in the range by 1 each time. Unfortunately, pdf_map_one_to_many spots the surrogates, and rewrites the data it is passed. And the data is then reused for the next call into pdf_map_one_to_many. The fix, implemented here, is to make pdf_map_one_to_many take a local copy of the values before it modifies them. This solves the problem.
- Loading branch information