You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2026/08/26 08:14:13 UTC
svn commit: r1937479 - pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter
Author: tilman
Date: Wed Aug 26 08:14:12 2026
New Revision: 1937479
Log:
PDFBOX-6243: improve validate dimension to avoid OOM
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java Wed Aug 26 08:14:09 2026 (r1937478)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java Wed Aug 26 08:14:12 2026 (r1937479)
@@ -67,6 +67,9 @@ final class CCITTFaxFilter extends Filte
long arraySizeLong = ((long) cols + 7) / 8 * rows;
+ // PDFBOX-6243: CCITTFaxDecoderStream allocates two int arrays: changesReferenceRow and changesCurrentRow
+ long changesSize = ((long) cols + 2) * 4 * 2;
+
long maxBytes = 256 * 1024 * 1024L;
String sysProp = System.getProperty(Filter.SYSPROP_CCITTFAX_MAXBYTES);
@@ -87,10 +90,11 @@ final class CCITTFaxFilter extends Filte
}
}
- if (arraySizeLong > maxBytes)
+ if (arraySizeLong + changesSize > maxBytes)
{
throw new IOException(
- "CCITT decode buffer too large (" + arraySizeLong + " bytes) for cols=" + cols +
+ "CCITT decode buffer too large (bitmapSize: " + arraySizeLong + ", changesSize: " +
+ changesSize + ") for cols=" + cols +
", rows=" + rows + "; max allowed=" + maxBytes +
"; increase " + Filter.SYSPROP_CCITTFAX_MAXBYTES + " to override"
);