Merge branch 'master' into nextversion

This commit is contained in:
Roberto Ierusalimschy 2024-01-25 13:52:52 -03:00
commit 108e0bdc84
8 changed files with 27 additions and 12 deletions

View file

@ -241,7 +241,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
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(getlngstr(ts), str, l * sizeof(char));