Skip to content

Commit

Permalink
fix: CSV-2024-22640 (#712)
Browse files Browse the repository at this point in the history
Add possessive quantifiers to the regex to prevent catastrophic backtracking.
  • Loading branch information
josh-gaby committed Apr 20, 2024
1 parent d4adef4 commit 05f3a28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/tcpdf_colors.php
Expand Up @@ -275,7 +275,7 @@ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'
$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|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) {
$returncolor = array();
switch ($m[1]) {
case 'cmyk': {
Expand Down

0 comments on commit 05f3a28

Please sign in to comment.