Skip to content

Out of range integers silently accepted #190

@amerry

Description

@amerry

If an integer constant that is too large or small to fit in an int64_t is specified in the toml file, it will be silently accepted and INT64_MAX or INT64_MIN will be set instead. There appears to be no way for code using toml11 to detect this (and, eg, report to the user that this will not have the expected behaviour).

Steps to reproduce

std::istringstream ss{"int_value = 9223372036854775808"};
auto const value = toml::parse(ss);
assert(value.as_table().at("int_value").as_integer() == 9223372036854775807);

Expected behaviour

toml::parse throws an exception (or maybe the problem is reported directly on the integer toml::value?).

Actual behaviour

toml::parse succeeds, and the assert passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions