[poppler] poppler/Function.cc poppler/MarkedContentOutputDev.cc poppler/TextOutputDev.cc

Albert Astals Cid aacid at kde.org
Sat Aug 20 08:18:27 UTC 2022


El dissabte, 20 d’agost de 2022, a les 4:55:28 (CEST), William Bader va 
escriure:
> > -    if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight
> > || x1 != x1 || y1 != y1 || // IEEE way of checking for isnan -        w1
> > != w1 || h1 != h1) {
> > +    if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight
> > || std::isnan(x1) || std::isnan(y1) || std::isnan(w1) || std::isnan(h1))
> > {
> Would it be better to test isnan before using the values, like
> 
> if (std::isnan(x1) || std::isnan(y1) || std::isnan(w1) || std::isnan(h1) ||
> x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight) {

Good question.

I agree that it really seems more logical to do what you suggest.

But the current code has worked for us for a long time so i chose to just 
rewrite the comparisons in a way that are easier to read (i.e. use isnan 
instead of x != x) over also rewriting the if order.

Cheers,
  Albert




More information about the poppler mailing list