Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/55894


Change subject: Fix non-terminating regexp in roundtrip-test.js
......................................................................

Fix non-terminating regexp in roundtrip-test.js

* The same comment regexp that caused trouble in the WTS existed
  in normalizeNewlines function in mediawiki.Util.js for a while.
  Looks like it got exercised recently and sent roundtrip-test.js
  into a coma.

  Wikipedia:Articles for deletion/Wynnton is one of the many pages
  in the Wikipedia namespace that ran into trouble.

* The regexp in question is: "<!--(?:[^-]+|-(?!->))*-->"
  Looks like the "+" match inside combined with the "*" outside sent
  the regexp into an infinite loop. Converting it into the (a|b)*
  form where a and b match exactly one char fixes it.  This is the
  same fix in all the other instances. Just documenting here for
  posterity with a little more detail.

Change-Id: I30acde6cc4e882061137a87d0ea523ce76066ac5
---
M js/lib/mediawiki.Util.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/94/55894/1

diff --git a/js/lib/mediawiki.Util.js b/js/lib/mediawiki.Util.js
index 7a8a435..4f287e5 100644
--- a/js/lib/mediawiki.Util.js
+++ b/js/lib/mediawiki.Util.js
@@ -918,7 +918,7 @@
 var normalizeNewlines = function ( source ) {
        return source
                                // strip comments first
-                               .replace(/<!--(?:[^-]+|-(?!->))*-->/gm, '')
+                               .replace(/<!--(?:[^\-]|-(?!->))*-->/gm, '')
 
                                // preserve a space for non-inter-tag-whitespace
                                // non-tag content followed by non-tag content

-- 
To view, visit https://gerrit.wikimedia.org/r/55894
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30acde6cc4e882061137a87d0ea523ce76066ac5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to