summaryrefslogtreecommitdiffstats
path: root/patches/source/poppler/poppler.CVE-2012-2142.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/source/poppler/poppler.CVE-2012-2142.diff')
-rw-r--r--patches/source/poppler/poppler.CVE-2012-2142.diff64
1 files changed, 64 insertions, 0 deletions
diff --git a/patches/source/poppler/poppler.CVE-2012-2142.diff b/patches/source/poppler/poppler.CVE-2012-2142.diff
new file mode 100644
index 000000000..9c6a2a56b
--- /dev/null
+++ b/patches/source/poppler/poppler.CVE-2012-2142.diff
@@ -0,0 +1,64 @@
+From 71bad47ed6a36d825b0d08992c8db56845c71e40 Mon Sep 17 00:00:00 2001
+From: Marek Kasik <mkasik@redhat.com>
+Date: Sun, 09 Dec 2012 19:20:00 +0000
+Subject: Filter stuff that might end up in the shell
+
+Since it seems shells don't know how to filter stuff and might causing bad things to happen
+---
+diff --git a/poppler/Error.cc b/poppler/Error.cc
+index 9d044bc..ce71820 100644
+--- a/poppler/Error.cc
++++ b/poppler/Error.cc
+@@ -16,6 +16,7 @@
+ // Copyright (C) 2005, 2007 Jeff Muizelaar <jeff@infidigm.net>
+ // Copyright (C) 2005 Albert Astals Cid <aacid@kde.org>
+ // Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
++// Copyright (C) 2012 Marek Kasik <mkasik@redhat.com>
+ //
+ // To see a description of the changes please see the Changelog file that
+ // came with your tarball or type make ChangeLog if you are building from git
+@@ -59,7 +60,7 @@ void setErrorCallback(void (*cbk)(void *data, ErrorCategory category,
+
+ void CDECL error(ErrorCategory category, int pos, const char *msg, ...) {
+ va_list args;
+- GooString *s;
++ GooString *s, *sanitized;
+
+ // NB: this can be called before the globalParams object is created
+ if (!errorCbk && globalParams && globalParams->getErrQuiet()) {
+@@ -68,17 +69,29 @@ void CDECL error(ErrorCategory category, int pos, const char *msg, ...) {
+ va_start(args, msg);
+ s = GooString::formatv(msg, args);
+ va_end(args);
++
++ sanitized = new GooString ();
++ for (int i = 0; i < s->getLength(); ++i) {
++ const char c = s->getChar(i);
++ if (c < (char)0x20 || c >= (char)0x7f) {
++ sanitized->appendf("<{0:02x}>", c & 0xff);
++ } else {
++ sanitized->append(c);
++ }
++ }
++
+ if (errorCbk) {
+- (*errorCbk)(errorCbkData, category, pos, s->getCString());
++ (*errorCbk)(errorCbkData, category, pos, sanitized->getCString());
+ } else {
+ if (pos >= 0) {
+ fprintf(stderr, "%s (%d): %s\n",
+- errorCategoryNames[category], pos, s->getCString());
++ errorCategoryNames[category], pos, sanitized->getCString());
+ } else {
+ fprintf(stderr, "%s: %s\n",
+- errorCategoryNames[category], s->getCString());
++ errorCategoryNames[category], sanitized->getCString());
+ }
+ fflush(stderr);
+ }
+ delete s;
++ delete sanitized;
+ }
+--
+cgit v0.9.0.2-2-gbebe
+