From ee1787dd512152314185d0cb4ebf15923f32a6b0 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Thu, 1 Mar 2018 13:59:43 -0500 Subject: [PATCH] Ensure abort link parsing on xmlish tag in link title position This shouldn't be dependent on the current definition of legal title chars and strip marker. See the test " inside a link" Change-Id: I0d87aca1bb0adf4ec5ac480e0373a65fcd150a72 --- includes/parser/Parser.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2adfd0a5d2..f6526ac564 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2215,8 +2215,14 @@ class Parser { $link = $origLink; } - $unstrip = $this->mStripState->unstripNoWiki( $link ); - $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null; + // \x7f isn't a default legal title char, so most likely strip + // markers will force us into the "invalid form" path above. But, + // just in case, let's assert that xmlish tags aren't valid in + // the title position. + $unstrip = $this->mStripState->killMarkers( $link ); + $noMarkers = ( $unstrip === $link ); + + $nt = $noMarkers ? Title::newFromText( $link ) : null; if ( $nt === null ) { $s .= $prefix . '[[' . $line; continue; -- 2.20.1