aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-01 16:07:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-01 16:07:03 -0300
commit03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575 (patch)
treebfa342b45e957a96d48ae05e677a50ca9b91538e
parent59a1adf194efe43741c2bb2005d93d8320a19d14 (diff)
downloadlua-03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575.tar.gz
lua-03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575.tar.bz2
lua-03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575.zip
Added missing casts from lua_Unsigned to size_t
size_t can be smaller than lua_Usigned.
-rw-r--r--lstrlib.c4
-rw-r--r--lundump.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/lstrlib.c b/lstrlib.c
index 306cd0bf..8056c6ff 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1811,8 +1811,8 @@ static int str_unpack (lua_State *L) {
1811 lua_Unsigned len = (lua_Unsigned)unpackint(L, data + pos, 1811 lua_Unsigned len = (lua_Unsigned)unpackint(L, data + pos,
1812 h.islittle, cast_int(size), 0); 1812 h.islittle, cast_int(size), 0);
1813 luaL_argcheck(L, len <= ld - pos - size, 2, "data string too short"); 1813 luaL_argcheck(L, len <= ld - pos - size, 2, "data string too short");
1814 lua_pushlstring(L, data + pos + size, len); 1814 lua_pushlstring(L, data + pos + size, cast_sizet(len));
1815 pos += len; /* skip string */ 1815 pos += cast_sizet(len); /* skip string */
1816 break; 1816 break;
1817 } 1817 }
1818 case Kzstr: { 1818 case Kzstr: {
diff --git a/lundump.c b/lundump.c
index ade40384..76f0ddc1 100644
--- a/lundump.c
+++ b/lundump.c
@@ -109,7 +109,7 @@ static lua_Unsigned loadVarint (LoadState *S, lua_Unsigned limit) {
109 109
110 110
111static size_t loadSize (LoadState *S) { 111static size_t loadSize (LoadState *S) {
112 return loadVarint(S, MAX_SIZE); 112 return cast_sizet(loadVarint(S, MAX_SIZE));
113} 113}
114 114
115 115