30
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-06-05 07:10:48 +00:00

6.0.039 (2013-10-13)

- Bug #843 "Wrong call in parser" was fixed.
- Bug #844 "Wrong object type named" was fixed.
- Bug #845 "Parsing error on obj ref prefixed by '000000'" was fixed.
This commit is contained in:
nicolaasuni 2013-10-13 22:02:11 +01:00
parent 2ba0248a71
commit 977539641b
2 changed files with 11 additions and 9 deletions

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version. * Current TCPDF version.
* @private static * @private static
*/ */
private static $tcpdf_version = '6.0.038'; private static $tcpdf_version = '6.0.039';
/** /**
* String alias for total number of pages. * String alias for total number of pages.

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf_parser.php // File name : tcpdf_parser.php
// Version : 1.0.010 // Version : 1.0.011
// Begin : 2011-05-23 // Begin : 2011-05-23
// Last Update : 2013-09-25 // Last Update : 2013-10-13
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 // License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -37,7 +37,7 @@
* This is a PHP class for parsing PDF documents.<br> * This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.010 * @version 1.0.011
*/ */
// include class for decoding filters // include class for decoding filters
@ -318,9 +318,9 @@ class TCPDF_PARSER {
} elseif ($filltrailer) { } elseif ($filltrailer) {
if (($v[0] == '/') AND ($v[1] == 'Size') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'numeric'))) { if (($v[0] == '/') AND ($v[1] == 'Size') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'numeric'))) {
$xref['trailer']['size'] = $sarr[($k +1)][1]; $xref['trailer']['size'] = $sarr[($k +1)][1];
} elseif (($v[0] == '/') AND ($v[1] == 'Root') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'ojbref'))) { } elseif (($v[0] == '/') AND ($v[1] == 'Root') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) {
$xref['trailer']['root'] = $sarr[($k +1)][1]; $xref['trailer']['root'] = $sarr[($k +1)][1];
} elseif (($v[0] == '/') AND ($v[1] == 'Info') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'ojbref'))) { } elseif (($v[0] == '/') AND ($v[1] == 'Info') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) {
$xref['trailer']['info'] = $sarr[($k +1)][1]; $xref['trailer']['info'] = $sarr[($k +1)][1];
} elseif (($v[0] == '/') AND ($v[1] == 'ID') AND (isset($sarr[($k +1)]))) { } elseif (($v[0] == '/') AND ($v[1] == 'ID') AND (isset($sarr[($k +1)]))) {
$xref['trailer']['id'] = array(); $xref['trailer']['id'] = array();
@ -494,7 +494,7 @@ class TCPDF_PARSER {
$next = strcspn($this->pdfdata, "\r\n", $offset); $next = strcspn($this->pdfdata, "\r\n", $offset);
if ($next > 0) { if ($next > 0) {
$offset += $next; $offset += $next;
return $this->getRawObject($this->pdfdata, $offset); return $this->getRawObject($offset);
} }
break; break;
} }
@ -629,12 +629,12 @@ class TCPDF_PARSER {
$offset += 9; $offset += 9;
} elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+R/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) { } elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+R/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) {
// indirect object reference // indirect object reference
$objtype = 'ojbref'; $objtype = 'objref';
$offset += strlen($matches[0]); $offset += strlen($matches[0]);
$objval = intval($matches[1]).'_'.intval($matches[2]); $objval = intval($matches[1]).'_'.intval($matches[2]);
} elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+obj/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) { } elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+obj/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) {
// object start // object start
$objtype = 'ojb'; $objtype = 'obj';
$objval = intval($matches[1]).'_'.intval($matches[2]); $objval = intval($matches[1]).'_'.intval($matches[2]);
$offset += strlen ($matches[0]); $offset += strlen ($matches[0]);
} elseif (($numlen = strspn($this->pdfdata, '+-.0123456789', $offset)) > 0) { } elseif (($numlen = strspn($this->pdfdata, '+-.0123456789', $offset)) > 0) {
@ -665,6 +665,8 @@ class TCPDF_PARSER {
return; return;
} }
$objref = $obj[0].' '.$obj[1].' obj'; $objref = $obj[0].' '.$obj[1].' obj';
// ignore leading zeros
$offset += strspn($this->pdfdata, '0', $offset);
if (strpos($this->pdfdata, $objref, $offset) != $offset) { if (strpos($this->pdfdata, $objref, $offset) != $offset) {
// an indirect reference to an undefined object shall be considered a reference to the null object // an indirect reference to an undefined object shall be considered a reference to the null object
return array('null', 'null', $offset); return array('null', 'null', $offset);