diff options
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/nextvar.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testes/nextvar.lua b/testes/nextvar.lua index 03810a8e..7e5bed56 100644 --- a/testes/nextvar.lua +++ b/testes/nextvar.lua | |||
| @@ -345,6 +345,18 @@ do | |||
| 345 | end | 345 | end |
| 346 | end | 346 | end |
| 347 | 347 | ||
| 348 | |||
| 349 | do print("testing attack on table length") | ||
| 350 | local t = {} | ||
| 351 | local lim = math.floor(math.log(math.maxinteger, 2)) - 1 | ||
| 352 | for i = lim, 0, -1 do | ||
| 353 | t[2^i] = true | ||
| 354 | end | ||
| 355 | assert(t[1 << lim]) | ||
| 356 | -- next loop should not take forever | ||
| 357 | for i = 1, #t do end | ||
| 358 | end | ||
| 359 | |||
| 348 | local nofind = {} | 360 | local nofind = {} |
| 349 | 361 | ||
| 350 | 362 | ||
