aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-12-01 17:34:49 +0100
committerPatrik Nyblom <[email protected]>2010-12-01 17:34:49 +0100
commit1ab2f46d91bce11bdc5b7ec65d3b3df46eadb105 (patch)
tree918b79cd7bbccc87a9d15ecbf96f26db17414802
parent30ad8cfadba47123920128023cb06af6e0922746 (diff)
downloadotp-1ab2f46d91bce11bdc5b7ec65d3b3df46eadb105.tar.gz
otp-1ab2f46d91bce11bdc5b7ec65d3b3df46eadb105.tar.bz2
otp-1ab2f46d91bce11bdc5b7ec65d3b3df46eadb105.zip
Make filelib not crash on re codepoints beyond 255 in re when filename is raw
-rw-r--r--lib/stdlib/src/filelib.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl
index eaaca750ab..04147d40d1 100644
--- a/lib/stdlib/src/filelib.erl
+++ b/lib/stdlib/src/filelib.erl
@@ -185,11 +185,14 @@ do_fold_files2([File|T], Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod) ->
FullName = filename:join(Dir, File),
case do_is_regular(FullName, Mod) of
true ->
- case re:run(File, if is_binary(File) -> OrigRE; true -> RegExp end,
- [{capture,none}]) of
+ case (catch re:run(File, if is_binary(File) -> OrigRE;
+ true -> RegExp end,
+ [{capture,none}])) of
match ->
Acc = Fun(FullName, Acc0),
do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc, Mod);
+ {'EXIT',_} ->
+ do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod);
nomatch ->
do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod)
end;