Blank pages on some PDF files
Categories
(Firefox :: PDF Viewer, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox93 | --- | affected |
People
(Reporter: starline98, Unassigned)
Details
(Whiteboard: [pdfjs-canvas-size])
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Steps to reproduce:
Open PDF file with Firefox browser
Actual results:
PDF opens with blank pages
Expected results:
File must be opened not with blank pages
Reporter | ||
Comment 1•4 years ago
|
||
Comment 2•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::PDF Viewer' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•4 years ago
|
||
Reproduced on latest Nightly 93.0a1 2021-09-06 under Win 10 64-bit.
This particular pdf was blank also on older Fx versions, like 63.0a1.
Comment 4•4 years ago
|
||
The console shows:
Message:
Stack: putBinaryImageData@resource://pdf.js/build/pdf.js:4895:11
paintInlineImageXObject@resource://pdf.js/build/pdf.js:6638:25
paintImageXObject@resource://pdf.js/build/pdf.js:6589:10
executeOperatorList@resource://pdf.js/build/pdf.js:5241:20
....
Comment 5•4 years ago
|
||
I can reproduce the bug using pdf.js from upstream and a local server with Firefox nightly but it works well in chrome.
So it's likely a Firefox issue, the guilty line is:
https://github.com/mozilla/pdf.js/blob/d95f680d66dd46e2995a7784109a1b3af2b84bdd/src/display/canvas.js#L596
In checking stderr with a local build, I get this:
Crash Annotation GraphicsCriticalError: |[C0][GFX1-]: Failed to allocate a surface due to invalid size (CDT) Size(9927,14043) (t=38.0922) [GFX1-]: Failed to allocate a surface due to invalid size (CDT) Size(9927,14043)
Reporter | ||
Comment 6•4 years ago
|
||
It opens well in Edge too. Hope you guys can figure out what's wrong cause i don't understand all these codes 😀
Comment 7•4 years ago
•
|
||
Increasing gfx.max-alloc-size
to 600000000
in about:config
fixes the issue.
The default value for this pref is 500000000
and here we're requesting 9927 * 14043 * 4 = 557619444
bytes.
So we should likely find a way in pdf.js to split too big images into tiles.
Reporter | ||
Comment 8•4 years ago
|
||
Nice! 👍
Comment 9•4 years ago
|
||
Is pdf.js canvas2d-only, or does it have a webgl path too?
Comment 10•4 years ago
|
||
canvas2d only
Comment 11•4 years ago
|
||
:jgilbert, could we consider to increase the value of gfx.max-alloc-size
to have the same as in Chrome ?
Comment 12•4 years ago
|
||
That would only be a bandaid, as some hardware/drivers cannot support higher values. (and therefore we're probably not robust to them failing, if we did raise this higher than they support) ~500MB is the lowest maximum allocation size that DirectX supports, though this scales upwards based on GPU RAM size. To avoid problems where this works on some devices and not others, it can be useful to have just one limit that's universal.
This is a constraint that we should be surfacing up the stack from the browser back to the application.
We may need a new API for this, if we don't have one already. (It doesn't look like we have one)
On WebGL this is handled by OUT_OF_MEMORY errors.
Therefore:
- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size needs to be updated, and
- the web platform needs a way to tell apps that an allocation like this failed, and
- pfd.js will need to be able to deal with limits being too small for some allocations.
Comment 13•4 years ago
|
||
A fourth thing to consider is downgrading a gpu-accelerated canvas to cpu-accelerated, which lets us have basically arbitrarily large canvases (memory allowing) but is considerably slower for operations that touch large parts of the canvas. I'm unsure if we have code to handle this live-downgrading yet.
Comment 14•4 years ago
|
||
Could the difference with Chrome cause web compat issues other than pdf.js? Or is this mostly a corner case?
Comment 15•4 years ago
|
||
Possible web-compat for sure, but likely quite rare. Worth noting though that if it fails on Firefox, then there are machines for which it likely fails on Chrome.
The largest canvas sizes we expect from most content are full-screen resolution sizes, which plateaus around 4k (32MB) or so. "8k" is still only 128MB.
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Updated•3 years ago
|
Comment 24•3 years ago
|
||
The severity field for this bug is relatively low, S4. However, the bug has 3 duplicates.
:calixte, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Description
•