Feature #85 ยป 0030-Apply-lua-5.4.6-upstream-patch-6.patch
| dependencies/lua-5.4/Version.txt | ||
|---|---|---|
|
(http://www.lua.org/ftp/lua-5.4.6.tar.gz)
|
||
|
Upstream bug fixes from https://www.lua.org/bugs.html applied:
|
||
|
1, 2, 3, 4
|
||
|
1, 2, 3, 4 & 5, 6
|
||
|
Not entire lua distribution directory hierarchy is included here, and
|
||
|
some files needed for Freeciv usage have been added.
|
||
| dependencies/lua-5.4/src/lstring.c | ||
|---|---|---|
|
return internshrstr(L, str, l);
|
||
|
else {
|
||
|
TString *ts;
|
||
|
if (l_unlikely(l >= (MAX_SIZE - sizeof(TString))/sizeof(char)))
|
||
|
if (l_unlikely(l * sizeof(char) >= (MAX_SIZE - sizeof(TString))))
|
||
|
luaM_toobig(L);
|
||
|
ts = luaS_createlngstrobj(L, l);
|
||
|
memcpy(getstr(ts), str, l * sizeof(char));
|
||
| dependencies/lua-5.4/src/lvm.c | ||
|---|---|---|
|
/* collect total length and number of strings */
|
||
|
for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) {
|
||
|
size_t l = vslen(s2v(top - n - 1));
|
||
|
if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) {
|
||
|
if (l_unlikely(l >= MAX_SIZE - sizeof(TString) - tl)) {
|
||
|
L->top.p = top - total; /* pop strings to avoid wasting stack */
|
||
|
luaG_runerror(L, "string length overflow");
|
||
|
}
|
||