From 23cf3e3a25dd34f8465bd69849dc4bb7fd6a62f4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 15 Dec 2017 16:41:59 +0000 Subject: (deftounicode): check that \pdfglyphtounicode target is in range [pdftex r786] git-svn-id: svn://tug.org/texlive/trunk@46069 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/pdftexdir/tounicode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/web2c/pdftexdir/tounicode.c b/Build/source/texk/web2c/pdftexdir/tounicode.c index 16ab10bdae2..716ebf6ea66 100644 --- a/Build/source/texk/web2c/pdftexdir/tounicode.c +++ b/Build/source/texk/web2c/pdftexdir/tounicode.c @@ -1,5 +1,5 @@ /* -Copyright 2006-2014 Han The Thanh, +Copyright 2006-2017 Han The Thanh, This file is part of pdfTeX. @@ -75,7 +75,7 @@ void deftounicode(strnumber glyph, strnumber unistr) p++; /* ignore leading spaces */ l = strlen(p); while (l > 0 && p[l - 1] == ' ') - l--; /* ignore traling spaces */ + l--; /* ignore trailing spaces */ valid_unistr = 1; /* a unicode value is the most common case */ for (i = 0; i < l; i++) { if (p[i] == ' ') @@ -117,6 +117,11 @@ void deftounicode(strnumber glyph, strnumber unistr) } else { i = sscanf(p, "%lX", &(gu->code)); assert(i == 1); + if (gu->code < 0 || gu->code > 0x10FFFF) { + pdftex_warn("ToUnicode: value out of range [0,10FFFF]: %X", + gu->code); + gu->code = UNI_UNDEF; + } } aa = avl_probe(glyph_unicode_tree, gu); assert(aa != NULL); -- cgit v1.2.3