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 2020/02/01 17:39:26 UTC
svn commit: r1873481 -
/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
Author: tilman
Date: Sat Feb 1 17:39:26 2020
New Revision: 1873481
URL: http://svn.apache.org/viewvc?rev=1873481&view=rev
Log:
PDFBOX-4742: throw Exception on NaN and Infinity
Modified:
pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java?rev=1873481&r1=1873480&r2=1873481&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java (original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java Sat Feb 1 17:39:26 2020
@@ -2465,9 +2465,15 @@ public final class PDPageContentStream i
* @param real the float value to be added to the content stream.
*
* @throws IOException if something went wrong
+ * @throws IllegalArgumentException if the parameter is not a finite number
*/
protected void writeOperand(float real) throws IOException
{
+ if (!Float.isFinite(real))
+ {
+ throw new IllegalArgumentException(real + "is not a finite number");
+ }
+
int byteCount = NumberFormatUtil.formatFloatFast(real, formatDecimal.getMaximumFractionDigits(), formatBuffer);
if (byteCount == -1)