[poppler] 2 commits - poppler/PSOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu May 16 12:27:54 PDT 2013


 poppler/PSOutputDev.cc |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 54f539b4436a1a3e0eab2ef0904c302865082982
Merge: b3d8f51 3a6e2de
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu May 16 21:27:47 2013 +0200

    Merge remote-tracking branch 'origin/poppler-0.22'

commit 3a6e2de1d35e3ee4fd86f71713c49bec8e09e41d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu May 16 21:27:02 2013 +0200

    Make sure that Title: doesn't contain \n or \n
    
    Bug #63862

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 95be97f..3f04696 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2006-2009, 2011, 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2009, 2011-2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2007, 2008 Brad Hards <bradh at kde.org>
 // Copyright (C) 2008, 2009 Koji Otani <sho at bbr.jp>
@@ -1414,7 +1414,14 @@ void PSOutputDev::writeHeader(int firstPage, int lastPage,
   obj1.free();
   info.free();
   if(psTitle) {
-    writePSFmt("%%Title: {0:s}\n", psTitle);
+    char *sanitizedTile = strdup(psTitle);
+    for (Guint i = 0; i < strlen(sanitizedTile); ++i) {
+      if (sanitizedTile[i] == '\n' || sanitizedTile[i] == '\r') {
+        sanitizedTile[i] = ' ';
+      }
+    }
+    writePSFmt("%%Title: {0:s}\n", sanitizedTile);
+    free(sanitizedTile);
   }
   writePSFmt("%%LanguageLevel: {0:d}\n",
 	     (level == psLevel1 || level == psLevel1Sep) ? 1 :


More information about the poppler mailing list