aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-25 10:38:56 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-25 10:38:56 -0300
commit7ceb2154ed69170f3e47f7a5a840e543c7c6ed3d (patch)
tree0db256dfe578fee0a88db6c887b40c3e262055a8 /llex.c
parent23e6bac8a0bbb9e5df43cbc0b7634b6d1395b0ff (diff)
downloadlua-7ceb2154ed69170f3e47f7a5a840e543c7c6ed3d.tar.gz
lua-7ceb2154ed69170f3e47f7a5a840e543c7c6ed3d.tar.bz2
lua-7ceb2154ed69170f3e47f7a5a840e543c7c6ed3d.zip
Fixed small bugs/issues
- In 'readutf8esc' (llex.c), the overflow check must be done before shifting the accumulator. It was working because tests were using 64-bit longs. Failed with 32-bit longs. - In OP_FORPREP (lvm.c), avoid negating an unsigned value. Visual Studio gives a warning for that operation, despite being well defined in ISO C. - In 'luaV_execute' (lvm.c), 'cond' can be defined only when needed, like all other variables.
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/llex.c b/llex.c
index 1539f525..b0bab377 100644
--- a/llex.c
+++ b/llex.c
@@ -334,8 +334,8 @@ static unsigned long readutf8esc (LexState *ls) {
334 r = gethexa(ls); /* must have at least one digit */ 334 r = gethexa(ls); /* must have at least one digit */
335 while ((save_and_next(ls), lisxdigit(ls->current))) { 335 while ((save_and_next(ls), lisxdigit(ls->current))) {
336 i++; 336 i++;
337 esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");
337 r = (r << 4) + luaO_hexavalue(ls->current); 338 r = (r << 4) + luaO_hexavalue(ls->current);
338 esccheck(ls, r <= 0x7FFFFFFFu, "UTF-8 value too large");
339 } 339 }
340 esccheck(ls, ls->current == '}', "missing '}'"); 340 esccheck(ls, ls->current == '}', "missing '}'");
341 next(ls); /* skip '}' */ 341 next(ls); /* skip '}' */