A couple of small String.fromCodePoint improvements (PR 11698 and 11769 follow-up)

- Add a reduced test-case for issue 11768, to prevent future regressions.
   (Given that PR 11769 is only a work-around, rather than a proper solution, it may not be entirely accurate for the issue to be closed as fixed.)

 - Add more validation of the charCode, as found by the heuristics, in `PartialEvaluator._buildSimpleFontToUnicode` to prevent future issues.
This commit is contained in:
Jonas Jenwald 2020-04-15 13:34:13 +02:00
parent 50bc4a18e8
commit 44b4a74f48
4 changed files with 8 additions and 1 deletions

View File

@ -2587,7 +2587,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
code = unicode;
}
}
if (code > 0 && Number.isInteger(code)) {
if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
// If `baseEncodingName` is one the predefined encodings, and `code`
// equals `charcode`, using the glyph defined in the baseEncoding
// seems to yield a better `toUnicode` mapping (fixes issue 5070).

View File

@ -236,6 +236,7 @@
!issue4061.pdf
!issue4668.pdf
!PDFJS-7562-reduced.pdf
!issue11768_reduced.pdf
!issue5039.pdf
!issue5070.pdf
!issue5238.pdf

Binary file not shown.

View File

@ -3109,6 +3109,12 @@
"type": "text",
"about": "Invisible (and broken) TrueType font used for text-selection."
},
{ "id": "issue11768",
"file": "pdfs/issue11768_reduced.pdf",
"md5": "0cafde97d78bb6883531a325a996a5ef",
"rounds": 1,
"type": "eq"
},
{ "id": "issue1912",
"file": "pdfs/issue1912.pdf",
"md5": "15305b7c2cba971e7423de3f6ad38fef",