Skip to content
Snippets Groups Projects
Verified Commit 86538bed authored by Houtan Bastani's avatar Houtan Bastani
Browse files

macro processor: only allow conversion to double from strings that precisely contain numeric values

parent 76f186fa
No related branches found
No related tags found
No related merge requests found
...@@ -315,7 +315,11 @@ String::cast_double() const ...@@ -315,7 +315,11 @@ String::cast_double() const
{ {
try try
{ {
return make_shared<Double>(stod(value), env); size_t pos = 0;
double value_d = stod(value, &pos);
if (pos != value.length())
throw StackTrace("Entire string not converted");
return make_shared<Double>(value_d, env);
} }
catch (...) catch (...)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment