2
0
mirror of https://github.com/boostorg/random.git synced 2026-01-19 04:22:17 +00:00

Check for range errors in the input operator of linear_congruential. Fixes #2667

[SVN r62548]
This commit is contained in:
Steven Watanabe
2010-06-08 04:03:58 +00:00
parent c11219f596
commit 463e1d4e0f

View File

@@ -193,7 +193,15 @@ public:
operator>>(std::basic_istream<CharT,Traits>& is,
linear_congruential& lcg)
{
return is >> lcg._x;
IntType x;
if(is >> x) {
if(x >= (lcg.min)() && x <= (lcg.max)()) {
lcg._x = x;
} else {
is.setstate(std::ios_base::failbit);
}
}
return is;
}
private: