diff options
-rw-r--r-- | source/pdf/pdf-cmap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/pdf/pdf-cmap.c b/source/pdf/pdf-cmap.c index 0764e32b..5593f967 100644 --- a/source/pdf/pdf-cmap.c +++ b/source/pdf/pdf-cmap.c @@ -543,6 +543,12 @@ add_range(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high, tree[current].low = high + 1; if (tree[current].low > tree[current].high) { + /* update lt/gt references that will be moved/stale after deleting current */ + if (gt == cmap->tlen - 1) + gt = current; + if (lt == cmap->tlen - 1) + lt = current; + /* delete_node() moves the element at cmap->tlen-1 into current */ move = delete_node(cmap, current); current = EMPTY; continue; |