You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Axel Howind (Jira)" <ji...@apache.org> on 2025/05/02 04:21:00 UTC
[jira] [Created] (PDFBOX-5999) fix initial ByteArrayOutputStream size for deflate operation
Axel Howind created PDFBOX-5999:
-----------------------------------
Summary: fix initial ByteArrayOutputStream size for deflate operation
Key: PDFBOX-5999
URL: https://issues.apache.org/jira/browse/PDFBOX-5999
Project: PDFBox
Issue Type: Bug
Reporter: Axel Howind
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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org