mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Validate additional font-dictionary properties
This commit is contained in:
parent
85e64b5c16
commit
08eb0566f7
4 changed files with 72 additions and 26 deletions
|
@ -23,6 +23,7 @@ import {
|
|||
} from "../shared/util.js";
|
||||
import { PostScriptLexer, PostScriptParser } from "./ps_parser.js";
|
||||
import { BaseStream } from "./base_stream.js";
|
||||
import { isNumberArray } from "./core_utils.js";
|
||||
import { LocalFunctionCache } from "./image_utils.js";
|
||||
|
||||
class PDFFunctionFactory {
|
||||
|
@ -117,16 +118,9 @@ function toNumberArray(arr) {
|
|||
if (!Array.isArray(arr)) {
|
||||
return null;
|
||||
}
|
||||
const length = arr.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (typeof arr[i] !== "number") {
|
||||
// Non-number is found -- convert all items to numbers.
|
||||
const result = new Array(length);
|
||||
for (let j = 0; j < length; j++) {
|
||||
result[j] = +arr[j];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (!isNumberArray(arr, null)) {
|
||||
// Non-number is found -- convert all items to numbers.
|
||||
return arr.map(x => +x);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue