mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Handle *empty* BigInt64Array/BigUint64Array in the isNumberArray
helper
The current checks would accidentally allow *empty* BigInt64Array/BigUint64Array, which we can fix by instead checking directly for those types. This should be fine since those types are available in all environments that we support, see: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array#browser_compatibility
This commit is contained in:
parent
4f1078dc63
commit
6281a89778
1 changed files with 1 additions and 1 deletions
|
@ -280,7 +280,7 @@ function isNumberArray(arr, len) {
|
|||
// BigInt64Array/BigUint64Array types (their elements aren't "number").
|
||||
return (
|
||||
ArrayBuffer.isView(arr) &&
|
||||
(arr.length === 0 || typeof arr[0] === "number") &&
|
||||
!(arr instanceof BigInt64Array || arr instanceof BigUint64Array) &&
|
||||
(len === null || arr.length === len)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue