poppler/Gfx.cc |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 2c17c9ed7e50ea15255c905170ab1da30b62b3c6
Author: Oliver Sander <oliver.san...@tu-dresden.de>
Date:   Sat May 2 16:52:09 2020 +0200

    Allow almost-singular tiling pattern matrices
    
    Issue https://gitlab.freedesktop.org/poppler/poppler/issues/894
    sports a file with a diagonal tiling pattern matrices with
    diagonal entries in the range of 5e-4.  While entries of this
    size are unusual but okay, the determinant is below the rather
    arbitrary threshold of 1e-6.  Therefore, poppler decided that
    the matrix is singular and aborts the rendering.
    
    Fix this by really only aborting if inverting the determinant
    (which is the first thing that is being done with it) results
    in a non-finite number.
    
    As a side effect the code now also allows pattern matrices
    with a negative determinant.  This does not seem to appear
    in the wild all that often, but I didn't find anything
    in the spec that rules it out.
    
    BUG: https://gitlab.freedesktop.org/poppler/poppler/issues/894

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 9773b60c..c248c576 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -42,7 +42,7 @@
 // Copyright (C) 2018, 2019 Adam Reichold <adam.reich...@t-online.de>
 // Copyright (C) 2018 Denis Onishchenko <denis.onische...@gmail.com>
 // Copyright (C) 2019 LE GARREC Vincent <legarrec.vinc...@gmail.com>
-// Copyright (C) 2019 Oliver Sander <oliver.san...@tu-dresden.de>
+// Copyright (C) 2019, 2020 Oliver Sander <oliver.san...@tu-dresden.de>
 // Copyright (C) 2019 Volker Krause <vkra...@kde.org>
 //
 // To see a description of the changes please see the Changelog file that
@@ -2061,11 +2061,11 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
 
   // construct a (device space) -> (pattern space) transform matrix
   det = m1[0] * m1[3] - m1[1] * m1[2];
-  if (fabs(det) < 0.000001) {
+  det = 1 / det;
+  if (!std::isfinite(det)) {
     error(errSyntaxError, getPos(), "Singular matrix in tiling pattern fill");
     return;
   }
-  det = 1 / det;
   imb[0] = m1[3] * det;
   imb[1] = -m1[1] * det;
   imb[2] = -m1[2] * det;
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to