From 0deea46ce7491e5d8168d3f3730868556b1ee221 Mon Sep 17 00:00:00 2001 From: Michael Santos Date: Sun, 24 Oct 2010 08:37:27 -0400 Subject: Fix crash in string:copies/2 Using a float for the number of copies results in an infinite loop. Check that the argument is an integer. Reported-By: Eric Pailleau --- lib/stdlib/src/string.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/stdlib/src/string.erl b/lib/stdlib/src/string.erl index 6636a03f06..c987c224db 100644 --- a/lib/stdlib/src/string.erl +++ b/lib/stdlib/src/string.erl @@ -201,7 +201,7 @@ chars(C, 0, Tail) when is_integer(C) -> -spec copies(string(), non_neg_integer()) -> string(). -copies(CharList, Num) when is_list(CharList), Num >= 0 -> +copies(CharList, Num) when is_list(CharList), is_integer(Num), Num >= 0 -> copies(CharList, Num, []). copies(_CharList, 0, R) -> -- cgit v1.2.3