Fix vulnerability to roman numeral bombs (#315)

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
This commit is contained in:
Florian Mortgat 2021-03-27 09:47:48 +01:00 committed by GitHub
parent f0e42daeae
commit e17b28015d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;