Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearrange exception #84

Closed
xeladotbe opened this issue May 24, 2024 · 4 comments
Closed

Rearrange exception #84

xeladotbe opened this issue May 24, 2024 · 4 comments
Assignees

Comments

@xeladotbe
Copy link
Contributor

Hello,

I am trying to manipulate a PDF or change the page order, I tried the rearrangePages method, but here I get the following exception:

ERROR Error: Uncaught (in promise): RuntimeError: memory access out of bounds
RuntimeError: memory access out of bounds
at mupdf-wasm.wasm
at mupdf-wasm.wasm
at mupdf-wasm.wasm
at mupdf-wasm.wasm
at Object._wasm_free (mupdf-wasm.js:705:12)
at PDFDocument.rearrangePages (mupdf.js:1722:22)

The exception is triggered by the following line in the finally block:

libmupdf._wasm_free(ptr);

But the reordering still works.

Thank you and regards,
Alex

@jamie-lemon
Copy link
Collaborator

Thanks - this sounds like a bug - we will look into it.

@ccxvii
Copy link
Collaborator

ccxvii commented Jun 10, 2024

Can you please provide a (minimal) script along with the PDF file that exhibits this issue.

@xeladotbe
Copy link
Contributor Author

Hey @ccxvii,

you can use the test.pdf from your tests folder:
https://github.com/ArtifexSoftware/mupdf.js/blob/master/examples/tests/test.pdf

The exception only occurs if you specify all pages of the PDF file, i.e.
PDF file has 3 pages

document.rearrangePages([0, 1]) => no exception
document.rearrangePages([0, 1, 2]) =>exception

Hope this helps. I can also provide a minimal script later.

Regards,
Alex

@xeladotbe
Copy link
Contributor Author

Hey @ccxvii ,

seems like the issue is gone with the latest release, I can't reproduce it anymore.

Regards,
Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants