summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2010-09-21 18:54:31 +0100
committerAlbert Astals Cid <aacid@kde.org>2010-09-21 18:54:31 +0100
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 25bdc0eb..3fe7f4f7 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -13,7 +13,7 @@
13// All changes made under the Poppler project to this file are licensed 13// All changes made under the Poppler project to this file are licensed
14// under GPL version 2 or later 14// under GPL version 2 or later
15// 15//
16// Copyright (C) 2005, 2008 Albert Astals Cid <aacid@kde.org> 16// Copyright (C) 2005, 2008, 2010 Albert Astals Cid <aacid@kde.org>
17// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com> 17// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
18// Copyright (C) 2010 Jakub Wilk <ubanus@users.sf.net> 18// Copyright (C) 2010 Jakub Wilk <ubanus@users.sf.net>
19// 19//
@@ -31,6 +31,7 @@
31#include <stdlib.h> 31#include <stdlib.h>
32#include <string.h> 32#include <string.h>
33#include "goo/gmem.h" 33#include "goo/gmem.h"
34#include "goo/GooLikely.h"
34#include "FoFiEncodings.h" 35#include "FoFiEncodings.h"
35#include "FoFiType1.h" 36#include "FoFiType1.h"
36#include "poppler/Error.h" 37#include "poppler/Error.h"
@@ -243,7 +244,7 @@ void FoFiType1::parse() {
243 code = code * 8 + (*p2 - '0'); 244 code = code * 8 + (*p2 - '0');
244 } 245 }
245 } 246 }
246 if (code < 256) { 247 if (likely(code < 256 && code >= 0)) {
247 for (p = p2; *p == ' ' || *p == '\t'; ++p) ; 248 for (p = p2; *p == ' ' || *p == '\t'; ++p) ;
248 if (*p == '/') { 249 if (*p == '/') {
249 ++p; 250 ++p;