mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-05 05:34:27 +02:00
Don't pass ill-formed strings to stold
* Avoid exceptions coming out of stold. * from_stream should always set failbit instead of throw.
This commit is contained in:
3
date.h
3
date.h
@@ -5334,7 +5334,10 @@ read_long_double(std::basic_istream<CharT, Traits>& is, unsigned m = 1, unsigned
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (count < m)
|
if (count < m)
|
||||||
|
{
|
||||||
is.setstate(std::ios::failbit);
|
is.setstate(std::ios::failbit);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return std::stold(buf);
|
return std::stold(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user