summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2010-09-21 17:54:31 (GMT)
committerAlbert Astals Cid <aacid@kde.org>2010-09-21 17:54:31 (GMT)
commit39d140bfc0b8239bdd96d6a55842034ae5c05473 (patch)
tree980e681febbb8e49f1dee712105e7716d24a221e
parentc6a091512745771894b54a71613fd6b5ca1adcb3 (diff)
Fix crash in broken pdf (code < 0)
Found thanks to PDF provided by Joel Voss of Leviathan Security Group
-rw-r--r--fofi/FoFiType1.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index 25bdc0e..3fe7f4f 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2005, 2008 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005, 2008, 2010 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2010 Jakub Wilk <ubanus@users.sf.net>
//
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include "goo/gmem.h"
+#include "goo/GooLikely.h"
#include "FoFiEncodings.h"
#include "FoFiType1.h"
#include "poppler/Error.h"
@@ -243,7 +244,7 @@ void FoFiType1::parse() {
code = code * 8 + (*p2 - '0');
}
}
- if (code < 256) {
+ if (likely(code < 256 && code >= 0)) {
for (p = p2; *p == ' ' || *p == '\t'; ++p) ;
if (*p == '/') {
++p;