summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-12 15:31:24 +0000
committerRobin Watts <robin@ghostscript.com>2012-01-12 18:06:51 +0000
commit269a44d92e2fc15631b86cc0c7135baf2023f312 (patch)
treed54ba2fdc498f6e0c069dff1d6aac43cb4d72091 /pdf
parent2f15b4c15438df7f6b1940a0036cc793be9fd9c3 (diff)
downloadmupdf-269a44d92e2fc15631b86cc0c7135baf2023f312.tar.xz
Avoid possible array overrun (and SEGV).
Check for cid being in range before using it. Thanks to Zeniko for spotting this.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_font.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index a04e6b56..d0a7241d 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -130,7 +130,7 @@ static int ft_cid_to_gid(pdf_font_desc *fontdesc, int cid)
return ft_char_index(fontdesc->font->ft_face, cid);
}
- if (fontdesc->cid_to_gid)
+ if (fontdesc->cid_to_gid && cid < fontdesc->cid_to_gid_len && cid >= 0)
return fontdesc->cid_to_gid[cid];
return cid;