Hashtags: 1MB limit for attempting to link (#544)

This commit is contained in:
Matt Wiebe 2023-11-01 10:53:27 -05:00 committed by GitHub
parent eda6d6d785
commit 74a774e8e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -43,6 +43,10 @@ class Hashtag {
* @return string the filtered post-content * @return string the filtered post-content
*/ */
public static function the_content( $the_content ) { public static function the_content( $the_content ) {
// small protection against execution timeouts: limit to 1 MB
if ( mb_strlen( $the_content ) > MB_IN_BYTES ) {
return $the_content;
}
$tag_stack = array(); $tag_stack = array();
$protected_tags = array( $protected_tags = array(
'pre', 'pre',

View file

@ -110,6 +110,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
* Improved: audio and video attachments are now supported! * Improved: audio and video attachments are now supported!
* Improved: better error messages if remote profile is not accessible * Improved: better error messages if remote profile is not accessible
* Improved: PHP 8.1 compatibility * Improved: PHP 8.1 compatibility
* Fixed: don't try to parse mentions or hashtags for very large (>1MB) posts to prevent timeouts
= 1.0.10 = = 1.0.10 =