From fd08a2fa7d97680be0c1013a848f44742bcb5c89 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Sun, 16 Feb 2014 16:01:35 +0000 Subject: [PATCH] 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. --- CHANGELOG.TXT | 4 ++++ README.TXT | 4 ++-- composer.json | 2 +- include/tcpdf_fonts.php | 2 +- include/tcpdf_static.php | 2 +- tcpdf.php | 6 +++--- tcpdf_parser.php | 16 +++++++++++----- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 5dd0624..72d920f 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,7 @@ +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. + 6.0.059 (2014-02-03) - SVG 'use' support was imporved. diff --git a/README.TXT b/README.TXT index d55bbe7..9e35a95 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.059 -Release date: 2014-02-03 +Version: 6.0.060 +Release date: 2014-02-16 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index c653067..679dca5 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.059", + "version": "6.0.060", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/include/tcpdf_fonts.php b/include/tcpdf_fonts.php index 0061948..bf7afdb 100644 --- a/include/tcpdf_fonts.php +++ b/include/tcpdf_fonts.php @@ -1140,7 +1140,7 @@ class TCPDF_FONTS { $subsetglyphs[$g] = true; } } - } + } break; } case 6: { // Format 6: Trimmed table mapping diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index f6c41df..cd3df3b 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.059'; + private static $tcpdf_version = '6.0.060'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index 2092f75..f8b8828 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,7 +1,7 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.059 + * @version 6.0.060 */ // 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.059 + * @version 6.0.060 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { diff --git a/tcpdf_parser.php b/tcpdf_parser.php index 86c9ce6..dfd0e96 100644 --- a/tcpdf_parser.php +++ b/tcpdf_parser.php @@ -3,7 +3,7 @@ // File name : tcpdf_parser.php // Version : 1.0.013 // Begin : 2011-05-23 -// Last Update : 2014-01-25 +// Last Update : 2014-02-16 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 // ------------------------------------------------------------------- @@ -103,12 +103,16 @@ class TCPDF_PARSER { if (empty($data)) { $this->Error('Empty PDF data.'); } - // set configuration parameters - $this->setConfig($cfg); + // find the pdf header starting position + if (($trimpos = strpos($data, '%PDF-')) === FALSE) { + $this->Error('Invalid PDF data: missing %PDF header.'); + } // get PDF content string - $this->pdfdata = $data; + $this->pdfdata = substr($data, $trimpos); // get length $pdflen = strlen($this->pdfdata); + // set configuration parameters + $this->setConfig($cfg); // get xref and trailer data $this->xref = $this->getXrefData(); // parse all document objects @@ -587,7 +591,9 @@ class TCPDF_PARSER { // remove white space characters $objval = strtr($matches[1], "\x09\x0a\x0c\x0d\x20", ''); $offset += strlen($matches[0]); - } + } elseif (($endpos = strpos($this->pdfdata, '>', $offset)) !== FALSE) { + $offset = $endpos + 1; + } } break; }