[
https://issues.apache.org/jira/browse/PDFBOX-5999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Lehmkühler updated PDFBOX-5999:
---------------------------------------
Affects Version/s: 3.0.5 PDFBox
2.0.34
4.0.0
> fix initial ByteArrayOutputStream size for deflate operation
> ------------------------------------------------------------
>
> Key: PDFBOX-5999
> URL: https://issues.apache.org/jira/browse/PDFBOX-5999
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.34, 3.0.5 PDFBox, 4.0.0
> Reporter: Axel Howind
> Priority: Minor
> Attachments: fix_initial_ByteArrayOutputStream_size.patch
>
>
> When I re-checked my last patch about initializing ByteArrayOutputStream
> instances with the matching size, I saw that I confused the deflate and
> inflate operations. Here the resulting array can be expected less in size
> than the original array:
> ```
> ByteArrayOutputStream deflated = new
> ByteArrayOutputStream(Math.max(32, data.length / 2));
> ```
> The patch fixes this and allocates half the size of the deflater input. This
> should be a good enough estimate in most cases.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]