From: Tim Starling Date: Fri, 30 May 2008 14:58:29 +0000 (+0000) Subject: Fixed excessive memory usage in PCRE in wfMangleFlashPolicy(). Was causing OOM on... X-Git-Tag: 1.31.0-rc.0~47287 X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;h=4b04f1a2eb4591299e0ef77cad37f4864f0c154f;p=lhc%2Fweb%2Fwiklou.git Fixed excessive memory usage in PCRE in wfMangleFlashPolicy(). Was causing OOM on various big pages. Possible upstream regression, deserves investigation. --- diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index b530b0a210..2b3e9fae55 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -102,7 +102,12 @@ function wfGzipHandler( $s ) { * Mangle flash policy tags which open up the site to XSS attacks. */ function wfMangleFlashPolicy( $s ) { - return preg_replace( '/\<\s*cross-domain-policy\s*\>/i', '', $s ); + # Avoid weird excessive memory usage in PCRE on big articles + if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $s ) ) { + return preg_replace( '/\<\s*cross-domain-policy\s*\>/i', '', $s ); + } else { + return $s; + } } /**