Skip to content

Commit

Permalink
FIX : fixes indexerror in cmap
Browse files Browse the repository at this point in the history
First Part fixing py-pdf#1091 (late)
Analysis of  'Hungarian' py-pdf#1533 still in progress
  • Loading branch information
pubpub-zz committed Jan 8, 2023
1 parent 5c0b11d commit 395f588
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pypdf/_cmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@ def parse_bfrange(
) -> Union[None, Tuple[int, int]]:
lst = [x for x in l.split(b" ") if x]
closure_found = False
nbi = max(len(lst[0]), len(lst[1]))
map_dict[-1] = ceil(nbi / 2)
fmt = b"%%0%dX" % (map_dict[-1] * 2)
if multiline_rg is not None:
fmt = b"%%0%dX" % (map_dict[-1] * 2)
a = multiline_rg[0] # a, b not in the current line
b = multiline_rg[1]
for sq in lst[1:]:
Expand All @@ -296,6 +294,9 @@ def parse_bfrange(
else:
a = int(lst[0], 16)
b = int(lst[1], 16)
nbi = max(len(lst[0]), len(lst[1]))
map_dict[-1] = ceil(nbi / 2)
fmt = b"%%0%dX" % (map_dict[-1] * 2)
if lst[2] == b"[":
for sq in lst[3:]:
if sq == b"]":
Expand Down

0 comments on commit 395f588

Please sign in to comment.