diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 1e6c28c093662fded108bf5b44d92b4a6036ccf6..5d5589eb97bb7c1e999a2f87b86e35d954a818dc 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -1424,7 +1424,7 @@ function _filter_url($text, $filter) {
$tasks['_filter_url_parse_full_links'] = $pattern;
// Match e-mail addresses.
- $url_pattern = "[A-Za-z0-9._-]+@(?:$domain)";
+ $url_pattern = "[A-Za-z0-9._-]{1,254}@(?:$domain)";
$pattern = "`($url_pattern)`";
$tasks['_filter_url_parse_email_links'] = $pattern;
diff --git a/core/modules/filter/filter.test b/core/modules/filter/filter.test
index b1b7b3e70913e550f84298f13d2e0057d10226c6..923a047825a6cf9dc7a5828c603ba61db5d85f92 100644
--- a/core/modules/filter/filter.test
+++ b/core/modules/filter/filter.test
@@ -1217,6 +1217,11 @@ class FilterUnitTestCase extends UnitTestBase {
// - absolute, mail, partial
// - characters/encoding, surrounding markup, security
+ // Create a e-mail that is too long.
+ $long_email = str_repeat('a', 254) . '@example.com';
+ $too_long_email = str_repeat('b', 255) . '@example.com';
+
+
// Filter selection/pattern matching.
$tests = array(
// HTTP URLs.
@@ -1228,10 +1233,12 @@ http://example.com or www.example.com
),
// MAILTO URLs.
'
-person@example.com or mailto:person2@example.com
+person@example.com or mailto:person2@example.com or ' . $long_email . ' but not ' . $too_long_email . '
' => array(
'person@example.com' => TRUE,
'mailto:person2@example.com' => TRUE,
+ '' . $long_email . '' => TRUE,
+ '' . $too_long_email . '' => FALSE,
),
// URI parts and special characters.
'