From 7929b6d32ec7ca6c7c57eb3383244ec0b6c6aab8 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Tue, 18 Feb 2014 19:39:15 +0000 Subject: [PATCH] 6.0.061 (2014-02-18) - Bug #893 "Parsing error on streamed xref for secured pdf" was fixed. --- CHANGELOG.TXT | 3 +++ README.TXT | 4 ++-- composer.json | 2 +- include/tcpdf_static.php | 2 +- tcpdf.php | 8 ++++---- tcpdf_parser.php | 18 +++++++++++++----- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 72d920f..6fd6911 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,6 @@ +6.0.061 (2014-02-18) + - Bug #893 "Parsing error on streamed xref for secured pdf" was fixed. + 6.0.060 (2014-02-16) - Bug #891 "Error on parsing hexa fields" was fixed. - Bug #892 "Parsing pdf with trailing space at start" was fixed. diff --git a/README.TXT b/README.TXT index 9e35a95..18f5ab0 100644 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 6.0.060 -Release date: 2014-02-16 +Version: 6.0.061 +Release date: 2014-02-18 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index 679dca5..75abed8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.060", + "version": "6.0.061", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index cd3df3b..06ea3e4 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.060'; + private static $tcpdf_version = '6.0.061'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index f8b8828..abee86e 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.060 + * @version 6.0.061 */ // TCPDF configuration @@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.0.060 + * @version 6.0.061 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { diff --git a/tcpdf_parser.php b/tcpdf_parser.php index dfd0e96..0b2a7e1 100644 --- a/tcpdf_parser.php +++ b/tcpdf_parser.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.013 + * @version 1.0.014 */ // include class for decoding filters @@ -291,7 +291,11 @@ class TCPDF_PARSER { } else { $filltrailer = false; } + if (!isset($xref['xref'])) { + $xref['xref'] = array(); + } $valid_crs = false; + $columns = 0; $sarr = $xrefcrs[0][1]; foreach ($sarr as $k => $v) { if (($v[0] == '/') AND ($v[1] == 'Type') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == '/') AND ($sarr[($k +1)][1] == 'XRef'))) { @@ -326,6 +330,8 @@ class TCPDF_PARSER { $xref['trailer']['root'] = $sarr[($k +1)][1]; } 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]; + } elseif (($v[0] == '/') AND ($v[1] == 'Encrypt') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) { + $xref['trailer']['encrypt'] = $sarr[($k +1)][1]; } elseif (($v[0] == '/') AND ($v[1] == 'ID') AND (isset($sarr[($k +1)]))) { $xref['trailer']['id'] = array(); $xref['trailer']['id'][0] = $sarr[($k +1)][1][0][1]; @@ -423,12 +429,14 @@ class TCPDF_PARSER { // default type field $sdata[$k][0] = 1; } - $i = 0; // count bytes on the row + $i = 0; // count bytes in the row // for every column for ($c = 0; $c < 3; ++$c) { // for every byte on the column for ($b = 0; $b < $wb[$c]; ++$b) { - $sdata[$k][$c] += ($row[$i] << (($wb[$c] - 1 - $b) * 8)); + if (isset($row[$i])) { + $sdata[$k][$c] += ($row[$i] << (($wb[$c] - 1 - $b) * 8)); + } ++$i; } }