C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394608 )

Change subject: Fix crasher with lonely `=` and `==`
......................................................................

Fix crasher with lonely `=` and `==`

This was a regression introduced in c167933204016ff1a2830623234423ad553e98c6
caused by a think-o about how our stops inc/dec logic works in pegjs.

Added test case to be extra safe for the future.

Change-Id: I4d6ba0f72fc9345915a7447132020d56b92ac9b6
---
M lib/wt2html/pegTokenizer.pegjs
M tests/parserTests.txt
2 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/08/394608/1

diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 3f3edd6..acf3a0c 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -493,14 +493,15 @@
        nested_block_line
        $'='+
      )?
+     & { return ce || s.length > 2; }
      endTPos:("" { return endOffset(); })
      spc:(spaces / comment)*
-     & { stops.dec('h'); return ce || s.length > 2; }
      &eolf
      {
         var c;
         var e;
         var level;
+        stops.dec('h');
         if (ce) {
             c = ce[0];
             e = ce[1];
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index a72a32f..c208a00 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -25128,15 +25128,22 @@
 !! options
 parsoid=wt2html,html2html
 !! wikitext
+=
+==
 ===
 ====
 =====
 !! html/php
+<p>=
+==
+</p>
 <h1><span class="mw-headline" id=".3D">=</span><span 
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit 
section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
 <h1><span class="mw-headline" id=".3D.3D">==</span><span 
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit 
section: ==">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
 <h2><span class="mw-headline" id=".3D_2">=</span><span 
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit 
section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 
 !! html/parsoid
+<p>=
+==</p>
 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d6ba0f72fc9345915a7447132020d56b92ac9b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

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

Reply via email to