mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Validate explicit destinations on the worker-thread to prevent DataCloneError
(issue 17981)
*Note:* This borrows a helper function from the viewer, however the code cannot be directly shared since the worker-thread has access to various primitives.
This commit is contained in:
parent
522af265a7
commit
7206d0a237
5 changed files with 81 additions and 34 deletions
|
@ -2933,10 +2933,9 @@ class WorkerTransport {
|
|||
getPageIndex(ref) {
|
||||
if (
|
||||
typeof ref !== "object" ||
|
||||
ref === null ||
|
||||
!Number.isInteger(ref.num) ||
|
||||
!Number.isInteger(ref?.num) ||
|
||||
ref.num < 0 ||
|
||||
!Number.isInteger(ref.gen) ||
|
||||
!Number.isInteger(ref?.gen) ||
|
||||
ref.gen < 0
|
||||
) {
|
||||
return Promise.reject(new Error("Invalid pageIndex request."));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue