You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parser::parse_array() calls array::emplace_back() even if parse_value() fails
array::emplace_back() does insert_at_back() and return *elems_.back(); - which is dereferencing nullptr.
dereferencing nullptr is undefined behavior - MSVC lets it pass, but GCC (libstdcpp) has proper assert.
The simplest fix probably would be something like 4a4bf1e. I didn't do PR because I would expect that some of the tests running on GCC already found the problem.
The text was updated successfully, but these errors were encountered:
Ah, yup, looks like parse_array() was assuming that parse_value() throws on failure, not taking into account exceptionless mode - a silly oversight on my part. Have pushed a fix to master.
Environment
TOML++ version 3.2.0
Compiler:
GCC 10
C++ standard mode:
C++ 17
Library configuration overrides:
TOML_ENABLE_FORMATTERS 0
TOML_EXCEPTIONS 0
Describe the bug
Assert in
unique_ptr::operator*
Steps to reproduce (or a small repro code sample)
Use value in TOML whih does not parse, like
Additional information
parser::parse_array()
callsarray::emplace_back()
even ifparse_value()
failsarray::emplace_back()
doesinsert_at_back()
andreturn *elems_.back();
- which is dereferencing nullptr.The simplest fix probably would be something like 4a4bf1e. I didn't do PR because I would expect that some of the tests running on GCC already found the problem.
The text was updated successfully, but these errors were encountered: