Bug 104786 - kpdf crashes on this file
Summary: kpdf crashes on this file
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: 0.4
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-29 19:55 UTC by Gioele Barabucci
Modified: 2005-04-30 16:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
The PDF files that make KPDF crash (40.51 KB, application/pdf)
2005-04-29 19:55 UTC, Gioele Barabucci
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gioele Barabucci 2005-04-29 19:55:03 UTC
Version:           0.4 (using KDE 3.4.0, Gentoo)
Compiler:          gcc version 3.4.3-20050110 (Gentoo Linux 3.4.3.20050110-r1, ssp-3.4.3.20050110-0, pie-8.7.7)
OS:                Linux (ppc) release 2.6.11-gentoo-r6

The "kpdf pioneer.pdf" command shows the window for a fraction of a second then crashes with this message:

  KCrash: Application 'kpdf' crashing...
  kpdf: Fatal IO error: client killed

I read other files without problem with KPDF.

I'm sorry to be unable to give you more details.
Comment 1 Gioele Barabucci 2005-04-29 19:55:59 UTC
Created attachment 10844 [details]
The PDF files that make KPDF crash
Comment 2 Thiago Macieira 2005-04-30 06:21:02 UTC
I can confirm, and there's no Crash Handler shown.
Comment 3 Enrico Ros 2005-04-30 10:29:18 UTC
bad stuff:
#6  0xb6babb52 in strncpy () from /lib/libc.so.6
#7  0xb67fc513 in FoFiType1::parse (this=0x81d2158) at FoFiType1.cc:169
#8  0x00000000 in ?? ()
Comment 4 Albert Astals Cid 2005-04-30 15:12:16 UTC
I've almost tracked it down to a "malformed" embedded type1 font that our parser is not as rubust as it should be
Comment 5 Albert Astals Cid 2005-04-30 16:34:59 UTC
CVS commit by aacid: 

Don't assume Encoding array of Type1 fonts end in "foo def".
http://partners.adobe.com/public/developer/en/font/T1_SPEC.PDF says "This sequence of assignments must be followed by an instance of the token def or readonly; such a token may not occur within the sequence of assignments." so it must end with "readonly" "def" "readonly def" (That is what most fonts are using and this is why it was not crashing"
BUG: 104786


  M +8 -3      FoFiType1.cc   1.2


--- kdegraphics/kpdf/xpdf/fofi/FoFiType1.cc  #1.1:1.2
@@ -188,7 +188,12 @@ void FoFiType1::parse() {
           }
         } else {
-          if (strtok(buf, " \t") &&
-              (p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) {
-            break;
+          p = strtok(buf, " \t\n\r");
+          if (p)
+          {
+            if (!strcmp(p, "def")) break;
+            if (!strcmp(p, "readonly")) break;
+            // the spec does not says this but i'm mantaining old xpdf behaviour that accepts "foo def" as end of the encoding array
+            p = strtok(buf, " \t\n\r");
+            if (p && !strcmp(p, "def")) break;
           }
         }