Skip to content

Running cube example in readme can crash on some files #196

Description

@braingram

The example contains:

    // This reads the top-level core/asdf-1.0.0 schema
    err = asdf_get_meta(file, "/", &meta);
    if (err == ASDF_VALUE_OK) {
        if (meta->history.entries[0]) {
            // This is a NULL-terminated array of asdf_history_entry_t*
            printf("first history entry: %s\n", meta->history.entries[0]->description);
        }
    }

when run with a file without a history entry the entries are indexed out of bounds and the program crashes (segfaults).

This example should be updated to check if an entry exists and produce an informative error if there is none.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions