Add even more validation of width-data (PR 18017 follow-up)

I missed this case in PR 18017, sorry about that.
This commit is contained in:
Jonas Jenwald 2024-05-02 11:24:15 +02:00
parent 16dbf5dcfd
commit 6c05f8b381

View file

@ -4315,11 +4315,15 @@ class PartialEvaluator {
dict, dict,
properties properties
); );
if (widths) { if (Array.isArray(widths)) {
const glyphWidths = []; const glyphWidths = [];
let j = firstChar; let j = firstChar;
for (const width of widths) { for (const w of widths) {
glyphWidths[j++] = this.xref.fetchIfRef(width); const width = this.xref.fetchIfRef(w);
if (typeof width === "number") {
glyphWidths[j] = width;
}
j++;
} }
newProperties.widths = glyphWidths; newProperties.widths = glyphWidths;
} else { } else {