From eda6d6d785c34e79346025ca92a68dce1de534a7 Mon Sep 17 00:00:00 2001 From: Matt Wiebe Date: Mon, 30 Oct 2023 14:32:04 -0500 Subject: [PATCH] Mentions: 1MB limit for attempting to link mentions, otherwise bail (#540) --- includes/class-mention.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-mention.php b/includes/class-mention.php index d55e5f2..beb6246 100644 --- a/includes/class-mention.php +++ b/includes/class-mention.php @@ -26,6 +26,10 @@ class Mention { * @return string the filtered post-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(); $protected_tags = array( 'pre',