mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°8637 - Alerts from dependabot, vulnerable libraries
* Update twig/twig from 3.16.0 to 3.21.1 * Update tecnickcom/tcpdf from 6.7.5 to 6.10.0 * Correct font folder case failing on linux server * Suppress documentation generator from project in favor of the online version * Update symfony/http-foundation from 6.4.2 to 6.4.14 Update symfony/runtime from 6.4.0 to 6.4.24
This commit is contained in:
@@ -275,7 +275,7 @@ class TCPDF_COLORS {
|
||||
$color = strtolower($color);
|
||||
// check for javascript color array syntax
|
||||
if (strpos($color, '[') !== false) {
|
||||
if (preg_match('/[\[][\"\'](t|g|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) {
|
||||
if (preg_match('/[\[][\"\'](t|g|rgba|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) {
|
||||
$returncolor = array();
|
||||
switch ($m[1]) {
|
||||
case 'cmyk': {
|
||||
@@ -286,7 +286,8 @@ class TCPDF_COLORS {
|
||||
$returncolor['K'] = max(0, min(100, (floatval($m[5]) * 100)));
|
||||
break;
|
||||
}
|
||||
case 'rgb': {
|
||||
case 'rgb':
|
||||
case 'rgba': {
|
||||
// RGB
|
||||
$returncolor['R'] = max(0, min(255, (floatval($m[2]) * 255)));
|
||||
$returncolor['G'] = max(0, min(255, (floatval($m[3]) * 255)));
|
||||
@@ -317,6 +318,25 @@ class TCPDF_COLORS {
|
||||
if (strlen($color) == 0) {
|
||||
return $defcol;
|
||||
}
|
||||
// RGBA ARRAY
|
||||
if (substr($color, 0, 4) == 'rgba') {
|
||||
$codes = substr($color, 5);
|
||||
$codes = str_replace(')', '', $codes);
|
||||
$returncolor = explode(',', $codes);
|
||||
// remove alpha component
|
||||
array_pop($returncolor);
|
||||
foreach ($returncolor as $key => $val) {
|
||||
if (strpos($val, '%') > 0) {
|
||||
// percentage
|
||||
$returncolor[$key] = (255 * intval($val) / 100);
|
||||
} else {
|
||||
$returncolor[$key] = intval($val); /* floatize */
|
||||
}
|
||||
// normalize value
|
||||
$returncolor[$key] = max(0, min(255, $returncolor[$key]));
|
||||
}
|
||||
return $returncolor;
|
||||
}
|
||||
// RGB ARRAY
|
||||
if (substr($color, 0, 3) == 'rgb') {
|
||||
$codes = substr($color, 4);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_fonts.php
|
||||
// Version : 1.1.0
|
||||
// Version : 1.1.1
|
||||
// Begin : 2008-01-01
|
||||
// Last Update : 2014-12-10
|
||||
// Last Update : 2024-12-23
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2008-2025 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -42,7 +42,7 @@
|
||||
* @class TCPDF_FONTS
|
||||
* Font methods for TCPDF library.
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 1.1.0
|
||||
* @version 1.1.1
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_FONTS {
|
||||
@@ -191,29 +191,30 @@ class TCPDF_FONTS {
|
||||
fclose($fp);
|
||||
// get font info
|
||||
$fmetric['Flags'] = $flags;
|
||||
preg_match ('#/FullName[\s]*\(([^\)]*)#', $font, $matches);
|
||||
preg_match ('#/FullName[\s]*+\(([^\)]*+)#', $font, $matches);
|
||||
$fmetric['name'] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $matches[1]);
|
||||
preg_match('#/FontBBox[\s]*{([^}]*)#', $font, $matches);
|
||||
$fmetric['bbox'] = trim($matches[1]);
|
||||
$bv = explode(' ', $fmetric['bbox']);
|
||||
$fmetric['Ascent'] = intval($bv[3]);
|
||||
$fmetric['Descent'] = intval($bv[1]);
|
||||
preg_match('#/ItalicAngle[\s]*([0-9\+\-]*)#', $font, $matches);
|
||||
preg_match('#/FontBBox[\s]*+{([^}]*+)#', $font, $matches);
|
||||
$rawbvl = explode(' ', trim($matches[1]));
|
||||
$bvl = [(int) $rawbvl[0], (int) $rawbvl[1], (int) $rawbvl[2], (int) $rawbvl[3]];
|
||||
$fmetric['bbox'] = implode(' ', $bvl);
|
||||
$fmetric['Ascent'] = $bvl[3];
|
||||
$fmetric['Descent'] = $bvl[1];
|
||||
preg_match('#/ItalicAngle[\s]*+([0-9\+\-]*+)#', $font, $matches);
|
||||
$fmetric['italicAngle'] = intval($matches[1]);
|
||||
if ($fmetric['italicAngle'] != 0) {
|
||||
$fmetric['Flags'] |= 64;
|
||||
}
|
||||
preg_match('#/UnderlinePosition[\s]*([0-9\+\-]*)#', $font, $matches);
|
||||
preg_match('#/UnderlinePosition[\s]*+([0-9\+\-]*+)#', $font, $matches);
|
||||
$fmetric['underlinePosition'] = intval($matches[1]);
|
||||
preg_match('#/UnderlineThickness[\s]*([0-9\+\-]*)#', $font, $matches);
|
||||
preg_match('#/UnderlineThickness[\s]*+([0-9\+\-]*+)#', $font, $matches);
|
||||
$fmetric['underlineThickness'] = intval($matches[1]);
|
||||
preg_match('#/isFixedPitch[\s]*([^\s]*)#', $font, $matches);
|
||||
preg_match('#/isFixedPitch[\s]*+([^\s]*+)#', $font, $matches);
|
||||
if ($matches[1] == 'true') {
|
||||
$fmetric['Flags'] |= 1;
|
||||
}
|
||||
// get internal map
|
||||
$imap = array();
|
||||
if (preg_match_all('#dup[\s]([0-9]+)[\s]*/([^\s]*)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) {
|
||||
if (preg_match_all('#dup[\s]([0-9]+)[\s]*+/([^\s]*+)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) {
|
||||
foreach ($fmap as $v) {
|
||||
$imap[$v[2]] = $v[1];
|
||||
}
|
||||
@@ -229,22 +230,22 @@ class TCPDF_FONTS {
|
||||
$eplain .= chr($chr ^ ($r >> 8));
|
||||
$r = ((($chr + $r) * $c1 + $c2) % 65536);
|
||||
}
|
||||
if (preg_match('#/ForceBold[\s]*([^\s]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/ForceBold[\s]*+([^\s]*+)#', $eplain, $matches) > 0) {
|
||||
if ($matches[1] == 'true') {
|
||||
$fmetric['Flags'] |= 0x40000;
|
||||
}
|
||||
}
|
||||
if (preg_match('#/StdVW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/StdVW[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) {
|
||||
$fmetric['StemV'] = intval($matches[1]);
|
||||
} else {
|
||||
$fmetric['StemV'] = 70;
|
||||
}
|
||||
if (preg_match('#/StdHW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/StdHW[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) {
|
||||
$fmetric['StemH'] = intval($matches[1]);
|
||||
} else {
|
||||
$fmetric['StemH'] = 30;
|
||||
}
|
||||
if (preg_match('#/BlueValues[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/BlueValues[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) {
|
||||
$bv = explode(' ', $matches[1]);
|
||||
if (count($bv) >= 6) {
|
||||
$v1 = intval($bv[2]);
|
||||
@@ -265,7 +266,7 @@ class TCPDF_FONTS {
|
||||
$fmetric['CapHeight'] = 700;
|
||||
}
|
||||
// get the number of random bytes at the beginning of charstrings
|
||||
if (preg_match('#/lenIV[\s]*([0-9]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/lenIV[\s]*+([\d]*+)#', $eplain, $matches) > 0) {
|
||||
$lenIV = intval($matches[1]);
|
||||
} else {
|
||||
$lenIV = 4;
|
||||
@@ -273,7 +274,7 @@ class TCPDF_FONTS {
|
||||
$fmetric['Leading'] = 0;
|
||||
// get charstring data
|
||||
$eplain = substr($eplain, (strpos($eplain, '/CharStrings') + 1));
|
||||
preg_match_all('#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
|
||||
preg_match_all('#/([A-Za-z0-9\.]*+)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
|
||||
if (!empty($enc) AND isset(TCPDF_FONT_DATA::$encmap[$enc])) {
|
||||
$enc_map = TCPDF_FONT_DATA::$encmap[$enc];
|
||||
} else {
|
||||
@@ -1780,9 +1781,9 @@ class TCPDF_FONTS {
|
||||
*/
|
||||
public static function UTF8ArrayToUniArray($ta, $isunicode=true) {
|
||||
if ($isunicode) {
|
||||
return array_map(get_called_class().'::unichrUnicode', $ta);
|
||||
return array_map(static::class.'::unichrUnicode', $ta);
|
||||
}
|
||||
return array_map(get_called_class().'::unichrASCII', $ta);
|
||||
return array_map(static::class.'::unichrASCII', $ta);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2002,7 +2003,7 @@ class TCPDF_FONTS {
|
||||
if ($isunicode) {
|
||||
// requires PCRE unicode support turned on
|
||||
$chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$carr = array_map(get_called_class().'::uniord', $chars);
|
||||
$carr = array_map(static::class.'::uniord', $chars);
|
||||
} else {
|
||||
$chars = str_split($str);
|
||||
$carr = array_map('ord', $chars);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_static.php
|
||||
// Version : 1.1.4
|
||||
// Version : 1.1.5
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2023-09-06
|
||||
// Last Update : 2024-12-23
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2023 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2002-2025 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -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.1.2
|
||||
* @version 1.1.5
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -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.1.1
|
||||
* @version 1.1.5
|
||||
* @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.7.5';
|
||||
private static $tcpdf_version = '6.10.0';
|
||||
|
||||
/**
|
||||
* String alias for total number of pages.
|
||||
@@ -106,6 +106,31 @@ class TCPDF_STATIC {
|
||||
*/
|
||||
public static $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox');
|
||||
|
||||
/**
|
||||
* Array of default cURL options for curl_setopt_array.
|
||||
*
|
||||
* @var array<int, bool|int|string> cURL options.
|
||||
*/
|
||||
protected const CURLOPT_DEFAULT = [
|
||||
CURLOPT_CONNECTTIMEOUT => 5,
|
||||
CURLOPT_MAXREDIRS => 5,
|
||||
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS,
|
||||
CURLOPT_SSL_VERIFYHOST => 2,
|
||||
CURLOPT_SSL_VERIFYPEER => true,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_USERAGENT => 'tcpdf',
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of fixed cURL options for curl_setopt_array.
|
||||
*
|
||||
* @var array<int, bool|int|string> cURL options.
|
||||
*/
|
||||
protected const CURLOPT_FIXED = [
|
||||
CURLOPT_FAILONERROR => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
/**
|
||||
@@ -379,7 +404,10 @@ class TCPDF_STATIC {
|
||||
if (function_exists('posix_getpid')) {
|
||||
$rnd .= posix_getpid();
|
||||
}
|
||||
if (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
|
||||
|
||||
if (function_exists('random_bytes')) {
|
||||
$rnd .= random_bytes(512);
|
||||
} elseif (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
|
||||
// this is not used on windows systems because it is very slow for a know bug
|
||||
$rnd .= openssl_random_pseudo_bytes(512);
|
||||
} else {
|
||||
@@ -387,7 +415,7 @@ class TCPDF_STATIC {
|
||||
$rnd .= uniqid('', true);
|
||||
}
|
||||
}
|
||||
return $rnd.$seed.__FILE__.serialize($_SERVER).microtime(true);
|
||||
return $rnd.$seed.__FILE__.microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1820,23 +1848,19 @@ class TCPDF_STATIC {
|
||||
*/
|
||||
public static function url_exists($url) {
|
||||
$crs = curl_init();
|
||||
// encode query params in URL to get right response form the server
|
||||
$url = self::encodeUrlQuery($url);
|
||||
curl_setopt($crs, CURLOPT_URL, $url);
|
||||
curl_setopt($crs, CURLOPT_NOBODY, true);
|
||||
curl_setopt($crs, CURLOPT_FAILONERROR, true);
|
||||
if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
|
||||
curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true);
|
||||
}
|
||||
curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($crs, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file');
|
||||
curl_setopt($crs, CURLOPT_MAXREDIRS, 5);
|
||||
if (defined('CURLOPT_PROTOCOLS')) {
|
||||
curl_setopt($crs, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS);
|
||||
}
|
||||
$curlopts = [];
|
||||
if (
|
||||
(ini_get('open_basedir') == '')
|
||||
&& (ini_get('safe_mode') === ''
|
||||
|| ini_get('safe_mode') === false)
|
||||
) {
|
||||
$curlopts[CURLOPT_FOLLOWLOCATION] = true;
|
||||
}
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_DEFAULT);
|
||||
$curlopts = array_replace($curlopts, K_CURLOPTS);
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_FIXED);
|
||||
$curlopts[CURLOPT_URL] = $url;
|
||||
curl_setopt_array($crs, $curlopts);
|
||||
curl_exec($crs);
|
||||
$code = curl_getinfo($crs, CURLINFO_HTTP_CODE);
|
||||
curl_close($crs);
|
||||
@@ -1957,22 +1981,19 @@ class TCPDF_STATIC {
|
||||
) {
|
||||
// try to get remote file data using cURL
|
||||
$crs = curl_init();
|
||||
curl_setopt($crs, CURLOPT_URL, $path);
|
||||
curl_setopt($crs, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($crs, CURLOPT_FAILONERROR, true);
|
||||
curl_setopt($crs, CURLOPT_RETURNTRANSFER, true);
|
||||
if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
|
||||
curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true);
|
||||
}
|
||||
curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($crs, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file');
|
||||
curl_setopt($crs, CURLOPT_MAXREDIRS, 5);
|
||||
if (defined('CURLOPT_PROTOCOLS')) {
|
||||
curl_setopt($crs, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS);
|
||||
$curlopts = [];
|
||||
if (
|
||||
(ini_get('open_basedir') == '')
|
||||
&& (ini_get('safe_mode') === ''
|
||||
|| ini_get('safe_mode') === false)
|
||||
) {
|
||||
$curlopts[CURLOPT_FOLLOWLOCATION] = true;
|
||||
}
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_DEFAULT);
|
||||
$curlopts = array_replace($curlopts, K_CURLOPTS);
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_FIXED);
|
||||
$curlopts[CURLOPT_URL] = $url;
|
||||
curl_setopt_array($crs, $curlopts);
|
||||
$ret = curl_exec($crs);
|
||||
curl_close($crs);
|
||||
if ($ret !== false) {
|
||||
@@ -2631,7 +2652,6 @@ class TCPDF_STATIC {
|
||||
return $page_mode;
|
||||
}
|
||||
|
||||
|
||||
} // END OF TCPDF_STATIC CLASS
|
||||
|
||||
//============================================================+
|
||||
|
||||
Reference in New Issue
Block a user