[poppler] poppler/SplashOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 6 09:36:36 UTC 2022


 poppler/SplashOutputDev.cc |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 58e30f9aac59437c438b973bedc6a7982349c63a
Author: Oliver Sander <oliver.sander at tu-dresden.de>
Date:   Sat Aug 6 09:53:52 2022 +0200

    Do not truncate line dash patterns with more than 20 entries
    
    Because otherwise files with longer patterns will not render
    correctly.  One example is the file in
    
      https://gitlab.freedesktop.org/poppler/poppler/-/issues/1281
    
    Fixes: 1281

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 695f867a..c690b5d3 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -53,6 +53,7 @@
 
 #include <cstring>
 #include <cmath>
+#include <vector>
 #include "goo/gfile.h"
 #include "GlobalParams.h"
 #include "Error.h"
@@ -1473,20 +1474,18 @@ void SplashOutputDev::updateLineDash(GfxState *state)
     double *dashPattern;
     int dashLength;
     double dashStart;
-    SplashCoord dash[20];
     int i;
 
     state->getLineDash(&dashPattern, &dashLength, &dashStart);
-    if (dashLength > 20) {
-        dashLength = 20;
-    }
+
+    std::vector<SplashCoord> dash(dashLength);
     for (i = 0; i < dashLength; ++i) {
         dash[i] = (SplashCoord)dashPattern[i];
         if (dash[i] < 0) {
             dash[i] = 0;
         }
     }
-    splash->setLineDash(dash, dashLength, (SplashCoord)dashStart);
+    splash->setLineDash(dash.data(), dashLength, (SplashCoord)dashStart);
 }
 
 void SplashOutputDev::updateFlatness(GfxState *state)


More information about the poppler mailing list