<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="signature_bookmark"></div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="elementToProof"><br>
> - if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight || x1 != x1 || y1 != y1 || // IEEE way of checking for isnan<br>
> - w1 != w1 || h1 != h1) {<br>
> + if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight || std::isnan(x1) || std::isnan(y1) || std::isnan(w1) || std::isnan(h1)) {</span></font></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="elementToProof"><br>
</span></font></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="elementToProof">Would it be better to test isnan before using the values, like</span></font></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="elementToProof"><br>
</span></font></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="elementToProof"><font size="2"><span style="font-size:11pt">if (std::isnan(x1) || std::isnan(y1) || std::isnan(w1) || std::isnan(h1)<font size="2"><span style="font-size:11pt"><font size="2"><span> || x1 +
w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight</span></font></span></font>) {</span></font><br>
</span></font></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="elementToProof"><br>
</span></font></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> poppler <poppler-bounces@lists.freedesktop.org> on behalf of GitLab Mirror <gitlab-mirror@kemper.freedesktop.org><br>
<b>Sent:</b> Friday, August 19, 2022 4:24 PM<br>
<b>To:</b> poppler@lists.freedesktop.org <poppler@lists.freedesktop.org><br>
<b>Subject:</b> [poppler] poppler/Function.cc poppler/MarkedContentOutputDev.cc poppler/TextOutputDev.cc</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">poppler/Function.cc | 4 ++--<br>
poppler/MarkedContentOutputDev.cc | 6 +++---<br>
poppler/TextOutputDev.cc | 3 +--<br>
3 files changed, 6 insertions(+), 7 deletions(-)<br>
<br>
New commits:<br>
commit 5bec49749b9a2a9b4779a977f673531b42470264<br>
Author: Albert Astals Cid <aacid@kde.org><br>
Date: Fri Aug 19 22:20:17 2022 +0200<br>
<br>
We can use isnan now<br>
<br>
diff --git a/poppler/Function.cc b/poppler/Function.cc<br>
index b97ad71e..043ae8e9 100644<br>
--- a/poppler/Function.cc<br>
+++ b/poppler/Function.cc<br>
@@ -13,7 +13,7 @@<br>
// All changes made under the Poppler project to this file are licensed<br>
// under GPL version 2 or later<br>
//<br>
-// Copyright (C) 2006, 2008-2010, 2013-2015, 2017-2020 Albert Astals Cid <aacid@kde.org><br>
+// Copyright (C) 2006, 2008-2010, 2013-2015, 2017-2020, 2022 Albert Astals Cid <aacid@kde.org><br>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net><br>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com><br>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com><br>
@@ -463,7 +463,7 @@ void SampledFunction::transform(const double *in, double *out) const<br>
// map input values into sample array<br>
for (int i = 0; i < m; ++i) {<br>
x = (in[i] - domain[i][0]) * inputMul[i] + encode[i][0];<br>
- if (x < 0 || x != x) { // x!=x is a more portable version of isnan(x)<br>
+ if (x < 0 || std::isnan(x)) {<br>
x = 0;<br>
} else if (x > sampleSize[i] - 1) {<br>
x = sampleSize[i] - 1;<br>
diff --git a/poppler/MarkedContentOutputDev.cc b/poppler/MarkedContentOutputDev.cc<br>
index 9a6f315b..e3a4cdce 100644<br>
--- a/poppler/MarkedContentOutputDev.cc<br>
+++ b/poppler/MarkedContentOutputDev.cc<br>
@@ -5,7 +5,7 @@<br>
// This file is licensed under the GPLv2 or later<br>
//<br>
// Copyright 2013 Igalia S.L.<br>
-// Copyright 2018-2020 Albert Astals Cid <aacid@kde.org><br>
+// Copyright 2018-2020, 2022 Albert Astals Cid <aacid@kde.org><br>
// Copyright 2021 Adrian Johnson <ajohnson@redneon.com><br>
// Copyright 2022 Oliver Sander <oliver.sander@tu-dresden.de><br>
//<br>
@@ -17,6 +17,7 @@<br>
#include "GfxState.h"<br>
#include "GfxFont.h"<br>
#include "Annot.h"<br>
+#include <cmath><br>
#include <vector><br>
<br>
MarkedContentOutputDev::MarkedContentOutputDev(int mcidA, const Object &stmObj) : currentFont(nullptr), currentText(nullptr), mcid(mcidA), pageWidth(0.0), pageHeight(0.0), unicodeMap(nullptr)<br>
@@ -181,8 +182,7 @@ void MarkedContentOutputDev::drawChar(GfxState *state, double xx, double yy, dou<br>
return;<br>
}<br>
<br>
- // Make a sanity check on character size. Note: (x != x) <-> isnan(x)<br>
- if (x1 != x1 || y1 != y1 || w1 != w1 || h1 != h1) {<br>
+ if (std::isnan(x1) || std::isnan(y1) || std::isnan(w1) || std::isnan(h1)) {<br>
return;<br>
}<br>
<br>
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc<br>
index 3ed1c90d..06fc3078 100644<br>
--- a/poppler/TextOutputDev.cc<br>
+++ b/poppler/TextOutputDev.cc<br>
@@ -2666,8 +2666,7 @@ void TextPage::addChar(const GfxState *state, double x, double y, double dx, dou<br>
// throw away chars that aren't inside the page bounds<br>
// (and also do a sanity check on the character size)<br>
state->transform(x, y, &x1, &y1);<br>
- if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight || x1 != x1 || y1 != y1 || // IEEE way of checking for isnan<br>
- w1 != w1 || h1 != h1) {<br>
+ if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight || std::isnan(x1) || std::isnan(y1) || std::isnan(w1) || std::isnan(h1)) {<br>
charPos += nBytes;<br>
return;<br>
}<br>
</div>
</span></font></div>
</body>
</html>