aboutsummaryrefslogtreecommitdiff
path: root/bugs
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-06-08 13:23:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-06-08 13:23:58 -0300
commit9b854e6dbcf569113f68e63d87644b69eb00a228 (patch)
tree11eb6b8f2bc3fe0e9138a7eea97ac84c343280ff /bugs
parent2b2d8ecd7aba6cc7604532c53372db01a30618d3 (diff)
downloadlua-9b854e6dbcf569113f68e63d87644b69eb00a228.tar.gz
lua-9b854e6dbcf569113f68e63d87644b69eb00a228.tar.bz2
lua-9b854e6dbcf569113f68e63d87644b69eb00a228.zip
BUG: string concatenation may cause arithmetic overflow, leading
to a buffer overflow.
Diffstat (limited to 'bugs')
-rw-r--r--bugs36
1 files changed, 36 insertions, 0 deletions
diff --git a/bugs b/bugs
index 59af0765..5ad6f1c5 100644
--- a/bugs
+++ b/bugs
@@ -633,3 +633,39 @@ patch = [[
633]], 633]],
634 634
635} 635}
636
637
638
639-----------------------------------------------------------------
640-- Lua 5.0.2
641
642Bug{
643what = [[string concatenation may cause arithmetic overflow, leading
644to a buffer overflow]],
645
646report = [[Rici Lake, 20/05/2004]],
647
648example = [[
649longs = string.rep("\0", 2^25)
650function catter(i)
651 return assert(loadstring(
652 string.format("return function(a) return a%s end",
653 string.rep("..a", i-1))))()
654end
655rep129 = catter(129)
656rep129(longs)
657]],
658
659patch = [[
660* lvm.c:
661329c329,331
662< tl += tsvalue(top-n-1)->tsv.len;
663---
664> size_t l = tsvalue(top-n-1)->tsv.len;
665> if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
666> tl += l;
667332d333
668< if (tl > MAX_SIZET) luaG_runerror(L, "string size overflow");
669]]
670}
671