Merge pull request #19118 from atm-florianm/FIX_12.0_tcpdf_issue_315_roman_numeral_bomb_vulnerability

FIX tcpdf roman numeral rendering bomb, cf. tecnickom/TCPDF PR 315
This commit is contained in:
Laurent Destailleur 2021-10-22 19:10:13 +02:00 committed by GitHub
commit fc0c4295bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -175,6 +175,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
of the function, replace:
$roman = '';
with:
$roman = '';
if ($number >= 4000) {
// do not represent numbers above 4000 in Roman numerals
return strval($number);
}

View File

@ -1440,6 +1440,10 @@ class TCPDF_STATIC {
*/
public static function intToRoman($number) {
$roman = '';
if ($number >= 4000) {
// do not represent numbers above 4000 in Roman numerals
return strval($number);
}
while ($number >= 1000) {
$roman .= 'M';
$number -= 1000;