You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/02/16 15:02:52 UTC
svn commit: r1874079 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
Author: lehmi
Date: Sun Feb 16 15:02:52 2020
New Revision: 1874079
URL: http://svn.apache.org/viewvc?rev=1874079&view=rev
Log:
PDFBOX-4778: check the result of a matrix multiplication for illegal values
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java?rev=1874079&r1=1874078&r2=1874079&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java Sun Feb 16 15:02:52 2020
@@ -396,7 +396,17 @@ public final class Matrix implements Clo
+ thisOperand[7] * otherOperand[5]
+ thisOperand[8] * otherOperand[8];
}
-
+ if (Float.isInfinite(result.single[0]) || Float.isNaN(result.single[0]) //
+ || Float.isInfinite(result.single[1]) || Float.isNaN(result.single[1]) //
+ || Float.isInfinite(result.single[2]) || Float.isNaN(result.single[2]) //
+ || Float.isInfinite(result.single[3]) || Float.isNaN(result.single[3]) //
+ || Float.isInfinite(result.single[4]) || Float.isNaN(result.single[4]) //
+ || Float.isInfinite(result.single[5]) || Float.isNaN(result.single[5]) //
+ || Float.isInfinite(result.single[6]) || Float.isNaN(result.single[6]) //
+ || Float.isInfinite(result.single[7]) || Float.isNaN(result.single[7]) //
+ || Float.isInfinite(result.single[8]) || Float.isNaN(result.single[8]))
+ throw new IllegalArgumentException(
+ "Multiplying two matrices produces illegal values");
return result;
}