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:
Jonas Jenwald 2024-04-22 13:47:54 +02:00
parent 522af265a7
commit 7206d0a237
5 changed files with 81 additions and 34 deletions

View file

@ -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."));