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 2023/06/15 03:52:05 UTC

svn commit: r1910414 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java

Author: tilman
Date: Thu Jun 15 03:52:04 2023
New Revision: 1910414

URL: http://svn.apache.org/viewvc?rev=1910414&view=rev
Log:
PDFBOX-5621: avoid NPE if the softmask has text

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java?rev=1910414&r1=1910413&r2=1910414&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java Thu Jun 15 03:52:04 2023
@@ -200,8 +200,22 @@ public abstract class PDFStreamEngine
         saveGraphicsState();
         Matrix softMaskCTM = getGraphicsState().getSoftMask().getInitialTransformationMatrix();
         getGraphicsState().setCurrentTransformationMatrix(softMaskCTM);
-        processTransparencyGroup(group);
-        restoreGraphicsState();
+
+        // PDFBOX-5621: save text matrices (softmasks may contain BT/ET)
+        Matrix textMatrixOld = textMatrix;
+        textMatrix = new Matrix();
+        Matrix textLineMatrixOld = textLineMatrix;
+        textLineMatrix = new Matrix();
+        try
+        {
+            processTransparencyGroup(group);
+        }
+        finally
+        {
+            textMatrix = textMatrixOld;
+            textLineMatrix = textLineMatrixOld;
+            restoreGraphicsState();
+        }
     }
 
     /**