lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Em qua., 30 de set. de 2020 às 13:18, Roberto Ierusalimschy <roberto@inf.puc-rio.br> escreveu:
> strlen already returns size_t.
> We can securely remove this useless cast?
>
> [...]
>        case Kzstr: {
> -        size_t len = (int)strlen(data + pos);
> +        size_t len = strlen(data + pos);
>          luaL_argcheck(L, pos + len < ld, 2,
>                           "unfinished string for format 'z'");

This is more than useless, it seems to be a bug. (C actually truncates
the result.) But we need a quite long string to hit it.
True, need a string with more than 4GB.

regards,
Ranier Vilela