diff options
author | Erlang/OTP <[email protected]> | 2010-04-21 14:55:14 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-04-21 14:55:14 +0000 |
commit | 65ff752e8f578839148e00923810d504c9fbb03a (patch) | |
tree | 2533310e1225e406d4afc45544d43b7f68e59df9 /lib/stdlib | |
parent | 9ac34d4580a6ba9af0f448cc3f1220036a0aa796 (diff) | |
parent | e746278e696c1d107eaccadbca810739396a5a2a (diff) | |
download | otp-65ff752e8f578839148e00923810d504c9fbb03a.tar.gz otp-65ff752e8f578839148e00923810d504c9fbb03a.tar.bz2 otp-65ff752e8f578839148e00923810d504c9fbb03a.zip |
Merge branch 'ms/re_infinite_loop' into dev
* ms/re_infinite_loop:
Add testcase for infinite loop problem caused by reset of match_call_count
re: Fix non-termination for a certain regular expression
OTP-8589 Pcre may hang on a special regexp
A bug in re that could cause certain regular expression matches never to
terminate is corrected. (Thanks to Michael Santos and Gordon Guthrie.)
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/test/re_SUITE.erl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index 4e78568a87..46a84d4e24 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -18,12 +18,12 @@ %% -module(re_SUITE). --export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_input_types/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1,pcre_cve_2008_2371/1,pcre_compile_workspace_overflow/1]). +-export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_input_types/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1,pcre_cve_2008_2371/1,pcre_compile_workspace_overflow/1,re_infinite_loop/1]). -include("test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_input_types,replace_return,split_autogen,split_options,split_specials,error_handling,pcre_cve_2008_2371,pcre_compile_workspace_overflow]. +all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_input_types,replace_return,split_autogen,split_options,split_specials,error_handling,pcre_cve_2008_2371,pcre_compile_workspace_overflow,re_infinite_loop]. pcre(doc) -> ["Run all applicable tests from the PCRE testsuites."]; @@ -552,3 +552,17 @@ pcre_compile_workspace_overflow(Config) when is_list(Config) -> ?line {error,{"internal error: overran compiling workspace",799}} = re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]), ok. +re_infinite_loop(doc) -> + "Make sure matches that really loop infinitely actually fail"; +re_infinite_loop(Config) when is_list(Config) -> + Dog = ?t:timetrap(?t:minutes(1)), + ?line Str = + "http:/www.flickr.com/slideShow/index.gne?group_id=&user_id=69845378@N0", + ?line EMail_regex = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+" + ++ "(\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*" + ++ "@.*([a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+" + ++ "([a-zA-Z]{2}|com|org|net|gov|mil" + ++ "|biz|info|mobi|name|aero|jobs|museum)", + ?line nomatch = re:run(Str, EMail_regex), + ?t:timetrap_cancel(Dog), + ok. |