fktn-k/fkYAML

Crash due to comments right after sequence block keys

fktn-k opened this issue · 0 comments

Description

Comments right after sequence block keys (before a newline code) cause segmentation faults.
This is related to #272.

Reproduction steps

Try parse the following YAML document:

foo: #comment
  - bar

Expected vs. actual results

The parse result should be something like:

foo:
  - bar

However, the parser crashes due to segmentation fault actually.

Minimal code example

#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    fkyaml::node node = fkyaml::node::deserialize("foo: #comment\n  - bar\n");
    std::cout << node << std::endl;
    return 0;
}

Error messages

SIGSEGV - Segmentation violation signal

Compiler and operating system

GCC 11.4.0 on Ubuntu 22.04 LTS

Library version

develop HEAD

Validation