Commit Graph
6 Commits
Author SHA1 Message Date
aiongg 69c87d2f3e Integration: #3195 keep CMap entries read before a stream ends inside a block
A begin… block cut off at the end of the stream returned None through ? and discarded the whole map; it now ends the scan like any other unparseable tail. Test: stream_cut_off_inside_a_block_keeps_the_entries_before_it.
2026-10-22 01:48:30 +00:00
Charan Rathore f6521cf64e hayro-cmap patch: tests for the unresolved-usecmap failure guard 2026-10-18 16:44:19 +05:30
Charan Rathore dd64f1797e hayro-cmap patch: an unresolved usecmap with no mappings reports failure 2026-10-18 16:43:48 +05:30
Charan Rathore e08950c8e6 hayro-cmap patch: truncated metadata-only streams report failure
Character-collection metadata is not a mapping: a truncated stream that
parsed only /Registry //Ordering //Supplement produced an empty CMap,
which callers accept and which then blocks the encoding fallback paths.
Drop the metadata exemption so a truncated stream with no mappings
returns no CMap, exactly as a full parse failure did before.

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
2026-10-18 13:34:49 +05:30
Charan Rathore e704504204 hayro-cmap patch: fix guard, entry alignment and array drain
- The truncated-stream guard was dead: completed was set on the break
  path too.  Detect truncation from the scanner position so a stream
  that yields nothing still reports failure and callers fall back to
  the font encoding.
- A skipped bfchar/bfrange entry consumed a different number of
  objects than a parsed one, shifting every later pair onto the wrong
  code.  Skip the entry's remaining objects as well.
- A bfrange array that runs out or breaks cannot be resynced to a
  member boundary; stop the loop instead of spinning over the rest of
  the range.

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
2026-10-18 13:21:57 +05:30
Charan Rathore bf27cb259a Vendor and patch hayro-cmap for tolerant CMap parsing
A /ToUnicode CMap with any unparsable part made the reading path
discard the whole map and fall back to the font encoding, so search
and redaction missed text the edit layer could read.  Vendor
hayro-cmap 0.1.0 and patch it to skip malformed bfchar/bfrange
entries, unresolvable usecmap references and unparseable tails,
keeping every readable entry, matching MuPDF/pdftotext and
PdfCraft's own edit-layer parser.

Fixes #3177.

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
2026-10-18 13:07:15 +05:30