lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 50b18f60cb31b361dff6af6cde8389352641d7c1
parent ad73e5156e488f48d291cb2ca0ea3dc0c8d3bdd8
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Wed,  5 Nov 2014 16:55:18 -0200

detail

Diffstat:
Mlstrlib.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lstrlib.c b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.213 2014/11/04 14:34:43 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.214 2014/11/05 18:50:29 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -1146,7 +1146,7 @@ static void packint (luaL_Buffer *b, lua_Unsigned n, n >>= NB; buff[islittle ? i : size - 1 - i] = (char)(n & MC); } - if (neg) { /* need sign extension (negative number)? */ + if (neg && size > SZINT) { /* negative number need sign extension? */ for (i = SZINT; i < size; i++) /* correct extra bytes */ buff[islittle ? i : size - 1 - i] = (char)MC; }