File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -926,7 +926,11 @@ class to_double_t
926
926
operator ()(const CharT* s, std::size_t len) const
927
927
{
928
928
double val = 0 ;
929
- std::from_chars (s, s+len, val);
929
+ const auto res = std::from_chars (s, s+len, val);
930
+ if (res.ec != std::errc ())
931
+ {
932
+ JSONCONS_THROW (json_runtime_error<std::invalid_argument>(" Convert string to double failed" ));
933
+ }
930
934
return val;
931
935
}
932
936
@@ -941,7 +945,11 @@ class to_double_t
941
945
}
942
946
943
947
double val = 0 ;
944
- std::from_chars (input.data (), input.data () + len, val);
948
+ const auto res = std::from_chars (input.data (), input.data () + len, val);
949
+ if (res.ec != std::errc ())
950
+ {
951
+ JSONCONS_THROW (json_runtime_error<std::invalid_argument>(" Convert string to double failed" ));
952
+ }
945
953
return val;
946
954
}
947
955
};
You can’t perform that action at this time.
0 commit comments