Skip to content

Nodes may be unaligned if they overwrite an existing value #11

@lukechampine

Description

@lukechampine

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions