lite3_set_impl only adds alignment padding when appending. When a key exists and the new value fits in the old slot, it reuses the existing val_start_ofs directly and does not realign it. Thus, if the existing value was unaligned, the node will be unaligned too.
Alignment is enforced on access: lite3_get_impl and others will check that the container offset is aligned and return EBADMSG if not. So you won't crash or anything horrible, but you can accidentally create a buffer that is unreadable.
Suggested fix: Add padding as necessary when overwriting values with nodes (and take this padding into account when determining whether the node will fit into the existing slot)
lite3_set_implonly adds alignment padding when appending. When a key exists and the new value fits in the old slot, it reuses the existing val_start_ofs directly and does not realign it. Thus, if the existing value was unaligned, the node will be unaligned too.Alignment is enforced on access:
lite3_get_impland others will check that the container offset is aligned and return EBADMSG if not. So you won't crash or anything horrible, but you can accidentally create a buffer that is unreadable.Suggested fix: Add padding as necessary when overwriting values with nodes (and take this padding into account when determining whether the node will fit into the existing slot)