shithub: libmujs

Download patch

ref: 57b698f0b20789f88a1540ca116c9102c2251dee
parent: 9d72b07e0b98edfbf14ab633f38e74c0c549f60f
author: Tor Andersson <[email protected]>
date: Thu Apr 26 09:30:13 EDT 2018

Return null if String.prototype.match with a global regex finds no matches.

--- a/jsstring.c
+++ b/jsstring.c
@@ -356,6 +356,11 @@
 		if (c - b == 0)
 			++a;
 	}
+
+	if (len == 0) {
+		js_pop(J, 1);
+		js_pushnull(J);
+	}
 }
 
 static void Sp_search(js_State *J)