--- poppler-0.10.7/poppler/CharCodeToUnicode.cc- 2009-05-02 14:14:56.000000000 +0200 +++ poppler-0.10.7/poppler/CharCodeToUnicode.cc 2009-06-01 22:24:17.000000000 +0200 @@ -279,7 +279,8 @@ error(-1, "Illegal entry in bfchar block in ToUnicode CMap"); break; } - if (!(n1 == 2 + nDigits && tok1[0] == '<' && tok1[n1 - 1] == '>' && + /* 29May09 wb Change n1 == 2 + nDigits to >= because some PDF files have an extra two leading zeros */ + if (!(n1 >= 2 + nDigits && tok1[0] == '<' && tok1[n1 - 1] == '>' && tok2[0] == '<' && tok2[n2 - 1] == '>')) { error(-1, "Illegal entry in bfchar block in ToUnicode CMap"); continue; @@ -289,6 +290,11 @@ error(-1, "Illegal entry in bfchar block in ToUnicode CMap"); continue; } + /* 29May09 wb Check that the code is in range after the previous change from == to >= 2 + nDigits */ + if (code1 >= (1L << nBits)) { + error(-1, "Illegal entry in bfchar block in ToUnicode CMap, beginbfchar followed by code %d > %d", code1, (1 << nBits)); + continue; + } addMapping(code1, tok2 + 1, n2 - 2, 0); } pst->getToken(tok1, sizeof(tok1), &n1);