lua-users home
lua-l archive

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

On 8/31/23 15:32, Roberto Ierusalimschy wrote:
31 августа 2023 г. 12:24:38 GMT+03:00, "云风 Cloud Wu" <> пишет:
I updated lua source from today, and my
project crashed.

I found the TString is not initialized before getshrstr().

I think it should be :

  ts = createstrobj(L, l, LUA_VSHRSTR, h);
  ts->shrlen = cast_byte(l);
  memcpy(getshrstr(ts), str, l * sizeof(char));

The `ts->shrlen` should be initialized before memcpy().
It was reported here
And, as far as we know, it shouldn't cause a crash, but only a failed
assert, if and only if asserts are on (which is not the default).

Absolutely true. I'm enabled LUAI_ASSERT and LUA_USE_APICHECK intentionally,

to make testing more rigorous in fuzzing tests.

-- Roberto