Skip to content

Commit

Permalink
Halt font registration when URL fails validation
Browse files Browse the repository at this point in the history
fixes #2994
  • Loading branch information
bsweeney committed Sep 15, 2022
1 parent 9adb812 commit 66431c5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/FontMetrics.php
Expand Up @@ -213,12 +213,14 @@ public function registerFont($style, $remoteFile, $context = null)
$allowed_protocols = $this->options->getAllowedProtocols();
if (!array_key_exists($protocol, $allowed_protocols)) {
Helpers::record_warnings(E_USER_WARNING, "Permission denied on $remoteFile. The communication protocol is not supported.", __FILE__, __LINE__);
return false;
}

foreach ($allowed_protocols[$protocol]["rules"] as $rule) {
[$result, $message] = $rule($remoteFile);
if ($result !== true) {
Helpers::record_warnings(E_USER_WARNING, "Error loading $remoteFile: $message", __FILE__, __LINE__);
return false;
}
}

Expand Down

0 comments on commit 66431c5

Please sign in to comment.