summaryrefslogtreecommitdiff
path: root/tests/single.lua
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-24 11:30:51 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-03-24 11:30:51 +0100
commit58c57c57354fce407b11c0d63f8926edf5f469c0 (patch)
tree821ee53984033997a569ac001f3ee7cf2b85d34c /tests/single.lua
parent00340610e70f3651d267a210e2c2914f1102d086 (diff)
downloadfengari-58c57c57354fce407b11c0d63f8926edf5f469c0.tar.gz
fengari-58c57c57354fce407b11c0d63f8926edf5f469c0.tar.bz2
fengari-58c57c57354fce407b11c0d63f8926edf5f469c0.zip
Missing overflow check in string.rep
Diffstat (limited to 'tests/single.lua')
-rw-r--r--tests/single.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/single.lua b/tests/single.lua
index 4bd159c..d9b6ce9 100644
--- a/tests/single.lua
+++ b/tests/single.lua
@@ -99,3 +99,9 @@ assert(string.lower("\0ABCc%$") == "\0abcc%$")
assert(string.rep('teste', 0) == '')
assert(string.rep('tés\00tê', 2) == 'tés\0têtés\000tê')
assert(string.rep('', 10) == '')
+
+if string.packsize("i") == 4 then
+ -- result length would be 2^31 (int overflow)
+ checkerror("too large", string.rep, 'aa', (1 << 30))
+ checkerror("too large", string.rep, 'a', (1 << 30), ',')
+end