From 52fb5abb0b69025cf5888af2491c06141fb9cdc8 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Wed, 27 Jan 2021 14:38:43 -0800 Subject: [PATCH] Fix font data clone error when pdfBug is enabled. The widths property should be an object to match what metrics returns. In ZapfDingbats.pdf I was getting a data clone error with pdfBug enabled. In buildCharCodeToWidth() there was an encoding with the name "at" which is also the name of a method on an array. buildCharCodeToWidth assumes an object is passed in, so when it checked for the "at" property, it found the method and copied it over. This only seemed to affect Firefox. --- src/core/evaluator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/evaluator.js b/src/core/evaluator.js index fb0c075ae..10b53f8e7 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3192,7 +3192,7 @@ class PartialEvaluator { getBaseFontMetrics(name) { var defaultWidth = 0; - var widths = []; + var widths = Object.create(null); var monospace = false; var stdFontMap = getStdFontMap(); var lookupName = stdFontMap[name] || name;