Skip to content

Inline nodes can reference text data of parent block #309

@nwellnhof

Description

@nwellnhof

When parsing inline nodes, some pieces of text are kept in the parent block's content buffer and referenced from inline children as non-allocated cmark_chunk pointing directly into the parent's buffer. If the parent is freed, these pointers become invalid. This can lead to memory corruption. for example when moving inline nodes to another tree and deleting the old parent.

I'd suggest to copy all text data to inline children (i. e. use chunk_clone instead of chunk_dup). Then we could also think about removing the content field for block nodes.

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