[poppler] poppler/poppler: PDFDoc.cc,1.2,1.3

Kristian Høgsberg krh at bitplanet.net
Mon Aug 8 05:19:21 EST 2005


Albert Astals Cid wrote:
> Here's my patch that does what i said.
> 
> Agree to commit?

Yep, looks good.

Kristian


> Albert
> 
> A Diumenge 07 Agost 2005 15:01, Albert Astals Cid va escriure:
> 
>>Wouldn't be better starting to check from the end of eof and not for the
>>start as %%EOF is supposed to be at the end of it?
>>
>>Albert
>>
>>A Diumenge 07 Agost 2005 07:51, Kristian Høgsberg va escriure:
>>
>>>Brad Hards wrote:
>>>
>>>>On Sun, 7 Aug 2005 08:59 am, Brad Hards wrote:
>>>>
>>>>>On Sat, 6 Aug 2005 21:47 pm, Albert Astals Cid wrote:
>>>>>
>>>>>>Update of /cvs/poppler/poppler/poppler
>>>>>>In directory gabe:/tmp/cvs-serv16924/poppler
>>>>>>
>>>>>>Modified Files:
>>>>>>	PDFDoc.cc
>>>>>>Log Message:
>>>>>>Increase EOF searching up to last 1024 characters
>>>>>
>>>>>Hmm, that broke the qt4 unittests:
>>>>
>>>>Actually, looks like most of the problem is one file - orientation.pdf.
>>>>See
>>>>http://cvs.freedesktop.org/poppler/test/unittestcases/orientation.pdf?r
>>>>ev =1.1&view=log
>>>>
>>>>I think that the problem is that strstr() stops at the first 0x00, and
>>>>that file (plus a few others I found, mostly linearized and/or
>>>>encrypted) do have embedded 0x00's. I hacked it (see below) to avoid
>>>>putting those into eof[], and it now Works For Me(tm).
>>>>
>>>>Should I commit this, ugly as it is?
>>>
>>>Hmm, I'd rather see something like
>>>
>>>    for (i = 0; i < len - 5; i++)
>>>      if (strncmp (eof + i, "%%EOF", 5) == 0)
>>>        break;
>>>
>>>etc.
>>>
>>>Kristian
>>>
>>>_______________________________________________
>>>poppler mailing list
>>>poppler at lists.freedesktop.org
>>>http://lists.freedesktop.org/mailman/listinfo/poppler
>>
>>______________________________________________
>>Renovamos el Correo Yahoo!
>>Nuevos servicios, ms seguridad
>>http://correo.yahoo.es
>>_______________________________________________
>>poppler mailing list
>>poppler at lists.freedesktop.org
>>http://lists.freedesktop.org/mailman/listinfo/poppler
>>
>>
>>------------------------------------------------------------------------
>>
>>Index: poppler/PDFDoc.cc
>>===================================================================
>>RCS file: /cvs/poppler/poppler/poppler/PDFDoc.cc,v
>>retrieving revision 1.4
>>diff -u -r1.4 PDFDoc.cc
>>--- poppler/PDFDoc.cc	6 Aug 2005 11:58:59 -0000	1.4
>>+++ poppler/PDFDoc.cc	7 Aug 2005 16:30:40 -0000
>>@@ -189,7 +189,15 @@
>>     eof[i] = ch;
>>   }
>>   eof[i] = '\0';
>>-  if (strstr(eof, "%%EOF") == NULL)
>>+
>>+  bool found = false;
>>+  for (i = i - 5; i >= 0; i--) {
>>+    if (strncmp (&eof[i], "%%EOF", 5) == 0) {
>>+      found = true;
>>+      break;
>>+    }
>>+  }
>>+  if (!found)
>>   {
>>     error(-1, "Document has not the mandatory ending %%EOF");
>>     errCode = errDamaged;
>>
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>poppler mailing list
>>poppler at lists.freedesktop.org
>>http://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list