[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_assert in the wrong place
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 7 Sep 2020 14:55:20 -0300
> This lua_assert: https://github.com/lua/lua/blob/6bc0f13505bf5d4f613d725fe008c79e72f83ddf/lstring.c#L206
>
> Should be two lines higher, before the call to luaS_hash, which dereferences str unconditionally.
'luaS_hash' does not dereference 'str' unconditionally, only when 'l' is
not zero. This assertion exists because 'memcpy' should not be called
with a NULL string even when the length is zero.
-- Roberto