Feature #1965 ยป 0028-Apply-patch-3-for-lua-5.5.0.patch
| dependencies/lua-5.5/Version.txt | ||
|---|---|---|
|
(http://www.lua.org/ftp/lua-5.5.0.tar.gz)
|
||
|
Upstream bug fixes from https://www.lua.org/bugs.html applied:
|
||
|
1, 2
|
||
|
1, 2, 3
|
||
|
Not entire lua distribution directory hierarchy is included here, and
|
||
|
some files needed for Freeciv usage have been added.
|
||
| dependencies/lua-5.5/src/lutf8lib.c | ||
|---|---|---|
|
l_uint32 res = 0; /* final result */
|
||
|
if (c < 0x80) /* ASCII? */
|
||
|
res = c;
|
||
|
else if (c >= 0xfe) /* c >= 1111 1110b ? */
|
||
|
return NULL; /* would need six or more continuation bytes */
|
||
|
else {
|
||
|
int count = 0; /* to count number of continuation bytes */
|
||
|
for (; c & 0x40; c <<= 1) { /* while it needs continuation bytes... */
|
||
| ... | ... | |
|
return NULL; /* invalid byte sequence */
|
||
|
res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */
|
||
|
}
|
||
|
lua_assert(count <= 5);
|
||
|
res |= ((l_uint32)(c & 0x7F) << (count * 5)); /* add first byte */
|
||
|
if (count > 5 || res > MAXUTF || res < limits[count])
|
||
|
if (res > MAXUTF || res < limits[count])
|
||
|
return NULL; /* invalid byte sequence */
|
||
|
s += count; /* skip continuation bytes read */
|
||
|
}
|
||