From 8f452530e61b299d4d48f82f41ab5364723607ae Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Wed, 5 Apr 2017 14:32:16 +0200 Subject: Stack guard for PCRE --- lib/stdlib/test/re_SUITE.erl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/stdlib/test') diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index 464027bade..a76ded5f60 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -612,9 +612,15 @@ pcre_cve_2008_2371(Config) when is_list(Config) -> %% http://vcs.pcre.org/viewvc/code/trunk/pcre_compile.c?r1=504&r2=505&view=patch pcre_compile_workspace_overflow(Config) when is_list(Config) -> N = 819, - {error,{"regular expression is too complicated",799}} = - re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]), - ok. + ExpStr = "Got expected error: ", + case re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]) of + {error, {"regular expression is too complicated" = Str,799}} -> + {comment, ExpStr ++ Str}; + {error, {"parentheses are too deeply nested (stack check)" = Str, _No}} -> + {comment, ExpStr ++ Str}; + Other -> + ?t:fail({unexpected, Other}) + end. %% Make sure matches that really loop infinitely actually fail. re_infinite_loop(Config) when is_list(Config) -> -- cgit v1.2.3