Menu

#884 Parsing error prev tag looking for

v1.0_(example)
closed
nobody
1
2014-01-25
2014-01-25
No

Hi,

I encountered issue on parsing the provided file.

[...]
0000025749 00000 n
0000026021 00000 n
0000029591 00000 n
trailer
<< /Size 2367/Root 1 0 R>>
xref
0 1
0000000000 65535 f
trailer
<</Size><0EB18498D4F5FA4B9FC2DA907C9C159A>]/Prev 573841/XRefStm 29591>>
startxref
621231
%%EOF
[...]

There is 2 trailers before the '%%EOF' tag but only one 'startxref'.
So, currently, the parsing generates an infinite loop because the 'Prev' tag is always found instead of ending with the trailer which doesn't contain any 'Prev' tag.

Here is my fix : (file : tcpdf_parser.php / line 237)

-        if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
+        if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+(start)?xref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {

Hope it helps.
BR

1 Attachments

Discussion

  • Nicola Asuni

    Nicola Asuni - 2014-01-25
    • status: open --> closed
     
  • Nicola Asuni

    Nicola Asuni - 2014-01-25

    OK. I have fixed this in a different way in TCPDF 6.0.056.
    Thank you for reporting this issue.

     

Log in to post a comment.