aboutsummaryrefslogtreecommitdiff
path: root/bugs
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-12-14 13:12:01 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-12-14 13:12:01 -0200
commit57f5b81da9f1f23380d20f164012e10c5f4fef94 (patch)
treef626d12697bfec8bba9290a0f11b29f71705eaab /bugs
parentfdc25a1ebfe9968dcec390dd556375105aa0be40 (diff)
downloadlua-57f5b81da9f1f23380d20f164012e10c5f4fef94.tar.gz
lua-57f5b81da9f1f23380d20f164012e10c5f4fef94.tar.bz2
lua-57f5b81da9f1f23380d20f164012e10c5f4fef94.zip
Bug: Long brackets with a huge number of '=' causes overflow
A long bracket with too many equal signs can overflow the 'int' used for the counting and some arithmetic done on the value. Changing the counter to 'size_t' avoids that. (Because what is counted goes to a buffer, an overflow in the counter will first raise a buffer-overflow error.)
Diffstat (limited to 'bugs')
-rw-r--r--bugs19
1 files changed, 19 insertions, 0 deletions
diff --git a/bugs b/bugs
index d7a717c3..a965025b 100644
--- a/bugs
+++ b/bugs
@@ -4017,6 +4017,25 @@ patch = [[
4017 4017
4018 4018
4019 4019
4020--[=[
4021Bug{
4022what = [[Long brackets with a huge number of '=' overflow some
4023internal buffer arithmetic]],
4024report = [[Marco, 2018/12/12]],
4025since = [[5.1]],
4026fix = nil,
4027example = [[
4028local eqs = string.rep("=", 0x3ffffffe)
4029local code = "return [" .. eqs .. "[a]" .. eqs .. "]"
4030print(#assert(load(code))())
4031]],
4032patch = [[
4033]]
4034}
4035]=]
4036
4037
4038
4020 4039
4021--[=[ 4040--[=[
4022Bug{ 4041Bug{