aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorMichael Santos <[email protected]>2010-10-24 08:37:27 -0400
committerBjörn Gustavsson <[email protected]>2010-10-26 15:58:22 +0200
commit0deea46ce7491e5d8168d3f3730868556b1ee221 (patch)
treedc0fd1c5fe9b6beb3f7125b1d6471721988659e2 /lib/stdlib/src
parent735dc6c4f7ef51f3ef64ad60382f8a09ca6b9451 (diff)
downloadotp-0deea46ce7491e5d8168d3f3730868556b1ee221.tar.gz
otp-0deea46ce7491e5d8168d3f3730868556b1ee221.tar.bz2
otp-0deea46ce7491e5d8168d3f3730868556b1ee221.zip
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
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/string.erl2
1 files changed, 1 insertions, 1 deletions
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) ->