[Tarantool-patches] [PATCH 0/5] Static buf in Lua, part 3

Cyrill Gorcunov gorcunov at gmail.com
Wed Jul 28 00:39:36 MSK 2021


On Tue, Jul 27, 2021 at 11:24:10PM +0200, Vladislav Shpilevoy wrote:
> Here we go again.
> 
> I see that Lua UUID helpers have L suffix and decimal helpers do not. Have no
> idea why, but decided not to change it here since it is not related to the patch
> goal.
> 
> I validated other usages of tt_uuid_str(), decimal_str(), tt_sprintf(),
> tt_statuc_buf(), tuple_str(), mp_str() and some others - they all seem to be
> fine now. But you can never say for sure.
> 
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-6259-static_buf-part3
> Issue: https://github.com/tarantool/tarantool/issues/6259

As to me the helpers

inline void
tt_uuid_to_string(const struct tt_uuid *uu, char *out)
{
	snprintf(out, UUID_STR_LEN + 1,
		"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
		uu->time_low, uu->time_mid, uu->time_hi_and_version,
		uu->clock_seq_hi_and_reserved, uu->clock_seq_low, uu->node[0],
		uu->node[1], uu->node[2], uu->node[3], uu->node[4], uu->node[5]);
}

should had been banned from the begining, length of output buffer
must be explicitly passed instead, ie

	buf[UUID_STR_LEN+1];
	tt_uuid_to_string(uu, buf, sizeof(buf));

but this is obviously unrelated to the series itself just wonder who
ever came up with such api at all, since it is just a bug lurking
around waiting to zap the caller's stack.

The series is good, thanks Vlad! Ack.


More information about the Tarantool-patches mailing list