Skip to content

Commit

Permalink
Check for iterator validity in inline table and date checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
skystrife committed Oct 22, 2018
1 parent 8d62a4c commit dcb675a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/cpptoml.h
Original file line number Diff line number Diff line change
Expand Up @@ -2877,7 +2877,8 @@ class parser
auto end_of_date = std::find_if(it, end, [](char c) {
return !is_number(c) && c != '-';
});
if (*end_of_date == ' ' && is_number(end_of_date[1]))
if (end_of_date != end && *end_of_date == ' ' && end_of_date + 1 != end
&& is_number(end_of_date[1]))
end_of_date++;
return std::find_if(end_of_date, end, [](char c) {
return !is_number(c) && c != 'T' && c != 'Z' && c != ':'
Expand Down Expand Up @@ -3102,7 +3103,7 @@ class parser
throw_parse_exception("Unterminated inline table");

consume_whitespace(it, end);
if (*it != '}') {
if (it != end && *it != '}') {
parse_key_value(it, end, tbl.get());
consume_whitespace(it, end);
}
Expand Down

0 comments on commit dcb675a

Please sign in to comment.