Avoid passing null bytes in regular expression in Object\Image

- Remove capturing expression for A|B in favor of bracket syntax in regular expression since matches aren't used.
- Regular expressions have their own character escape notation including backslashes that need to be escaped in a PHP string.
- Actually address https://github.com/friendica/friendica/issues/13761#issuecomment-1949930922
This commit is contained in:
Hypolite Petovan 2024-02-17 22:27:37 -05:00
parent 08fa51d0bb
commit 1956c2ecfd

View file

@ -100,7 +100,7 @@ class Image
} }
if ($this->imageType == IMAGETYPE_GIF) { if ($this->imageType == IMAGETYPE_GIF) {
$count = @preg_match_all("#\x00\x21\xF9\x04.{4}\x00(\x2C|\x21)#s", $data); $count = preg_match_all("#\\x00\\x21\\xF9\\x04.{4}\\x00[\\x2C\\x21]#s", $data);
return ($count > 0); return ($count > 0);
} }