SECURITY: Malformed URL could crash V8

This commit is contained in:
Robin Ward 2014-09-12 13:19:15 -04:00
parent 2c6d03f87f
commit 1e880fd5e1
1 changed files with 7 additions and 5 deletions

View File

@ -1349,12 +1349,14 @@
return [ consumed, link ]; return [ consumed, link ];
} }
if (text.indexOf('(') === 0 && text.indexOf(')') !== -1) {
m = text.match(new RegExp("^\\((" + urlRegexp + ")\\)")); m = text.match(new RegExp("^\\((" + urlRegexp + ")\\)"));
if (m && m[1]) { if (m && m[1]) {
consumed += m[0].length; consumed += m[0].length;
link = ["link", {href: m[1]}].concat(children); link = ["link", {href: m[1]}].concat(children);
return [consumed, link]; return [consumed, link];
} }
}
// [Alt text][id] // [Alt text][id]
// [Alt text] [id] // [Alt text] [id]