6.0.027 (2013-09-14)

- A bug in tcpdf_parser wen parsing hexadecimal strings was fixed.
- A bug in tcpdf_parser wen looking for statxref was fixed.
- A bug on RC4 encryption was fixed.
This commit is contained in:
nicolaasuni 2013-09-14 20:02:50 +01:00
parent d9e2ca6348
commit 88efb72a26
6 changed files with 35 additions and 27 deletions

View File

@ -1,3 +1,8 @@
6.0.027 (2013-09-14)
- A bug in tcpdf_parser wen parsing hexadecimal strings was fixed.
- A bug in tcpdf_parser wen looking for statxref was fixed.
- A bug on RC4 encryption was fixed.
6.0.026 (2013-09-14)
- A bug in tcpdf_parser wen decoding streams was fixed.

View File

@ -8,7 +8,7 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.026
Version: 6.0.027
Release date: 2013-09-14
Author: Nicola Asuni

View File

@ -1,6 +1,6 @@
{
"name": "tecnick.com/tcpdf",
"version": "6.0.026",
"version": "6.0.027",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_static.php
// Version : 1.0.001
// Version : 1.0.002
// Begin : 2002-08-03
// Last Update : 2013-09-04
// Last Update : 2013-09-14
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -38,7 +38,7 @@
* This is a PHP class that contains static methods for the TCPDF class.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.001
* @version 1.0.002
*/
/**
@ -46,7 +46,7 @@
* Static methods used by the TCPDF class.
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 1.0.001
* @version 1.0.002
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_STATIC {
@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.0.026';
private static $tcpdf_version = '6.0.027';
/**
* String alias for total number of pages.
@ -1428,7 +1428,7 @@ class TCPDF_STATIC {
* @public static
*/
public static function _RC4($key, $text, &$last_enc_key, &$last_enc_key_c) {
if (function_exists('mcrypt_decrypt') AND ($out = @mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $text, MCRYPT_MODE_STREAM, ''))) {
if (function_exists('mcrypt_encrypt') AND ($out = @mcrypt_encrypt(MCRYPT_ARCFOUR, $key, $text, MCRYPT_MODE_STREAM, ''))) {
// try to use mcrypt function if exist
return $out;
}

View File

@ -1,7 +1,7 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.026
// Version : 6.0.027
// Begin : 2002-08-03
// Last Update : 2013-09-14
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -139,7 +139,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.0.026
* @version 6.0.027
*/
// TCPDF configuration
@ -163,7 +163,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.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.026
* @version 6.0.027
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {

View File

@ -1,7 +1,7 @@
<?php
//============================================================+
// File name : tcpdf_parser.php
// Version : 1.0.004
// Version : 1.0.005
// Begin : 2011-05-23
// Last Update : 2013-09-14
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -37,7 +37,7 @@
* This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.004
* @version 1.0.005
*/
// include class for decoding filters
@ -48,7 +48,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
* This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf
* @brief This is a PHP class for parsing PDF documents..
* @version 1.0.003
* @version 1.0.005
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_PARSER {
@ -135,16 +135,17 @@ class TCPDF_PARSER {
}
$matches = array_pop($matches);
$startxref = $matches[1];
} elseif (strpos($this->pdfdata, 'xref', $offset) == $offset) {
// Already pointing at the xref table
$startxref = $offset;
} elseif (preg_match('/([0-9]+[\s][0-9]+[\s]obj)/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset)) {
// Cross-Reference Stream object
$startxref = $offset;
} elseif (preg_match('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset)) {
// startxref found
$startxref = $matches[1][0];
} else {
if (preg_match('/([0-9]+[\s][0-9]+[\s]obj)/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset)) {
// Cross-Reference Stream object
$startxref = $offset;
} elseif (preg_match('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset)) {
// startxref found
$startxref = $matches[1][0];
} else {
$this->Error('Unable to find startxref');
}
$this->Error('Unable to find startxref');
}
// check xref position
if (strpos($this->pdfdata, 'xref', $startxref) == $startxref) {
@ -209,6 +210,7 @@ class TCPDF_PARSER {
}
if (preg_match('/Encrypt[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) {
$xref['trailer']['encrypt'] = intval($matches[1]).'_'.intval($matches[2]);
$this->Error('Encrypted documents are not supported!');
}
if (preg_match('/Info[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) {
$xref['trailer']['info'] = intval($matches[1]).'_'.intval($matches[2]);
@ -447,7 +449,7 @@ class TCPDF_PARSER {
// skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP)
$offset += strspn($this->pdfdata, "\x00\x09\x0a\x0c\x0d\x20", $offset);
// get first char
$char = $this->pdfdata{$offset};
$char = $this->pdfdata[$offset];
// get object type
switch ($char) {
case '%': { // \x25 PERCENT SIGN
@ -545,8 +547,9 @@ class TCPDF_PARSER {
// hexadecimal string object
$objtype = $char;
++$offset;
if (($char == '<') AND (preg_match('/^([0-9A-Fa-f]+)[>]/iU', substr($this->pdfdata, $offset), $matches) == 1)) {
$objval = $matches[1];
if (($char == '<') AND (preg_match('/^([0-9A-Fa-f\x09\x0a\x0c\x0d\x20]+)>/iU', substr($this->pdfdata, $offset), $matches) == 1)) {
// remove white space characters
$objval = strtr($matches[1], "\x09\x0a\x0c\x0d\x20", '');
$offset += strlen($matches[0]);
}
}
@ -636,7 +639,7 @@ class TCPDF_PARSER {
$i = 0; // object main index
do {
// get element
$element = $this->getRawObject($offset);
$element = $this->getRawObject($offset); print_r($element);//DEBUG
$offset = $element[2];
// decode stream using stream's dictionary information
if ($decoding AND ($element[0] == 'stream') AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == '<<')) {