30 lines
918 B
Text
30 lines
918 B
Text
$NetBSD: patch-ae,v 1.3 2010/10/25 19:30:04 markd Exp $
|
|
|
|
Fix for CVE-2010-3704
|
|
|
|
--- kpdf/xpdf/fofi/FoFiType1.cc.orig 2007-05-14 07:39:30.000000000 +0000
|
|
+++ kpdf/xpdf/fofi/FoFiType1.cc
|
|
@@ -18,6 +18,14 @@
|
|
#include "FoFiEncodings.h"
|
|
#include "FoFiType1.h"
|
|
|
|
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
|
|
+# define likely(x) __builtin_expect((x), 1)
|
|
+# define unlikely(x) __builtin_expect((x), 0)
|
|
+#else
|
|
+# define likely(x) (x)
|
|
+# define unlikely(x) (x)
|
|
+#endif
|
|
+
|
|
//------------------------------------------------------------------------
|
|
// FoFiType1
|
|
//------------------------------------------------------------------------
|
|
@@ -224,7 +232,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;
|