[
https://issues.apache.org/jira/browse/PDFBOX-4690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16976853#comment-16976853
]
Tilman Hausherr edited comment on PDFBOX-4690 at 11/18/19 8:20 PM:
-------------------------------------------------------------------
No, you would have to extend/replace PageDrawer.java which is somewhat tricky
and your PDFs won't look good. Stencil images are usually harmless, this is
just a badly made PDF. There are many ways in PDF to exploit its algorithmic
complexity vulnerabilities.
There will have to be a better solution in the future, maybe (tricky) use the
clipping region to limit the size, or (easier) put a hard limit like already
done in TilingPaint. There the size is limited to 3000 x 3000. (can be set
higher if wanted)
was (Author: tilman):
No, you would have to extend/replace PageDrawer.java which is somewhat tricky
and your PDFs won't look good. Stencil images are usually harmless, this is
just a badly made PDF. There are many ways in PDF to "abuse" the algorithms.
There will have to be a better solution in the future, maybe (tricky) use the
clipping region to limit the size, or (easier) put a hard limit like already
done in TilingPaint. There the size is limited to 3000 x 3000. (can be set
higher if wanted)
> PDFBOX running out of memory when rendering into image
> ------------------------------------------------------
>
> Key: PDFBOX-4690
> URL: https://issues.apache.org/jira/browse/PDFBOX-4690
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.11, 2.0.16, 2.0.17
> Environment: Docker Container with linux
> I have allocated 10GB of RAM.
> Reporter: Himanshu Pandey
> Priority: Blocker
> Attachments: crash.pdf
>
>
> I am running into Out of memory when trying to render attached PDF at page
> number 4.
> {{ }}
> {{ java.lang.OutOfMemoryError: Java heap spacejava.lang.OutOfMemoryError:
> Java heap space at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75)
> at java.awt.image.Raster.createPackedRaster(Raster.java:467) at
> java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
> at java.awt.image.BufferedImage.<init>(BufferedImage.java:333) at
> org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:979) at
> org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:62)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
> at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:246) at
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:225) at
> org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:164)}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]