CVE-2009-4035: Code Injection

Published Nov 26, 2009
·
Updated

SuSE reported a buffer overflow in FoFiType1::parse affecting older xpdf versions. Code snippets from fofi/FoFiType1.cc:

133 void FoFiType1::parse() { ... 163 line = getNextLine(line); 164 for (j = 0; j < 300 && line; ++j) { 165 line1 = getNextLine(line); 166 if ((n = line1 - line) > 255) { 167 n = 255; 168 } 169 strncpy(buf, line, n);

getNextLine can, however, return NULL:

117 char FoFiType1::getNextLine(char line) { 118 while (line < (char )file + len && line != '\x0a' && line != '\x0d') { 119 ++line; 120 } 121 if (line < (char )file + len && line == '\x0d') { 122 ++line; 123 } 124 if (line < (char )file + len && line == '\x0a') { 125 ++line; 126 } 127 if (line >= (char )file + len) { 128 return NULL; 129 }

Therefore, (line1 - line) is not defined / results in negative value n. That value is later passed to strncpy, causing overflow of buf buffer.

Other sources

The FoFiType1::parse function in fofi/FoFiType1.cc in Xpdf 3.0.0, gpdf 2.8.2, kpdf in kdegraphics 3.3.1, and possibly other libraries and versions, does not check the return value of the getNextLine function, which allows context-dependent attackers to execute arbitrary code via a PDF file with a crafted Type 1 font that can produce a negative value, leading to a signed-to-unsigned integer conversion error and a buffer overflow.

MITRE

Affected Software

4 affected components
Gnome Gpdf=2.8.2
KDE kpdf=3.3.1
KDE kdegraphics=3.3.1
xpdf Xpdf=3.0.0

Event History

Nov 26, 2009
Data Sourced
01:57 PM
DescriptionSeverityAffected Software
Dec 21, 2009
CVE Published
via MITRE·09:00 PM
Data Sourced
via MITRE·09:00 PM
Description
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2009-4035?

CVE-2009-4035 has a high severity rating due to the buffer overflow vulnerability that can lead to code execution.

2

How do I fix CVE-2009-4035?

To fix CVE-2009-4035, you should upgrade to the patched versions of affected software such as Gnome GPDF 2.8.3 or newer.

3

Which software is affected by CVE-2009-4035?

CVE-2009-4035 affects older versions of Gnome GPDF, KDE KPDF, KDE Graphics, and Xpdf.

4

What are the potential consequences of exploiting CVE-2009-4035?

Exploiting CVE-2009-4035 could allow an attacker to execute arbitrary code on the vulnerable system.

5

Is CVE-2009-4035 a remote or local vulnerability?

CVE-2009-4035 is primarily a local vulnerability, but it can be triggered by opening malicious PDF files.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203