diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-06-19 17:23:29 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-06-19 17:23:29 -0300 |
| commit | dc59444cd120e38d0babaeb3a7ad3d36f63225e6 (patch) | |
| tree | 4f6007975cd3d11855ab135b52c1bb285118c36a | |
| parent | 6c042e17b15f1381296a7ec1cd207741ade71170 (diff) | |
| download | lua-dc59444cd120e38d0babaeb3a7ad3d36f63225e6.tar.gz lua-dc59444cd120e38d0babaeb3a7ad3d36f63225e6.tar.bz2 lua-dc59444cd120e38d0babaeb3a7ad3d36f63225e6.zip | |
strong collision for very small numbers used as table keys
| -rw-r--r-- | bugs | 17 |
1 files changed, 17 insertions, 0 deletions
| @@ -1476,6 +1476,23 @@ ldebug.c: | |||
| 1476 | } | 1476 | } |
| 1477 | 1477 | ||
| 1478 | Bug{ | 1478 | Bug{ |
| 1479 | what = [[Very small numbers all collide in the hash function. | ||
| 1480 | (This creates only performance problems; the behavoir is correct.)]], | ||
| 1481 | report = [[, on ]], | ||
| 1482 | since = [[Lua 5.0]], | ||
| 1483 | example = [[ ]], | ||
| 1484 | patch = [[ | ||
| 1485 | ltable.c: | ||
| 1486 | 87,88c87,88 | ||
| 1487 | < n += 1; /* normalize number (avoid -0) */ | ||
| 1488 | < lua_assert(sizeof(a) <= sizeof(n)); | ||
| 1489 | --- | ||
| 1490 | > if (luai_numeq(n, 0)) /* avoid problems with -0 */ | ||
| 1491 | > return gnode(t, 0); | ||
| 1492 | ]], | ||
| 1493 | } | ||
| 1494 | |||
| 1495 | Bug{ | ||
| 1479 | what = [[ ]], | 1496 | what = [[ ]], |
| 1480 | report = [[ , on ]], | 1497 | report = [[ , on ]], |
| 1481 | since = [[i ]], | 1498 | since = [[i ]], |
