Skip to content

overindented (likely valid) YAML causes abort #223

@matt-deboer

Description

@matt-deboer

version: v0.4.0
compiler: clang-13
os: ubuntu 20.04

A bit of a strange case, but after checking a few yaml validators online, this yaml seems valid, but causes error:

auto yaml = R"config(
            A:
                - 1
                - 4
            B:
                - 2
                - 3
            )config";
ryml::Callbacks callbacks{};
callbacks.m_error = [](const char *msg, size_t msg_len, ryml::Location location, void *)
{
    throw std::runtime_error({msg, msg_len});
};
ryml::Tree tree{callbacks};
ryml::parse_in_arena(ryml::to_csubstr(yaml), &tree);
std::cout << "parsed:" << std::endl << tree << std::endl;

The output is:

_deps/ryml-src/ext/c4core/src/c4/substr.hpp:207: ERROR: check failed: i >= 0 && i < len

SIGABRT - Abort

(also fails to trigger the callbacks configured on tree)

yes, I'm aware that the yaml created by that multiline string literal is actually this (which yaml validators seem to think is fine):


            A:
                - 1
                - 4
            B:
                - 2
                - 3
            

checked at:

Is there something I'm using incorrectly? or is this a bug?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions