Added assert. Thanks to Jean-Pierre Münch for the suggestion

pull/35/head
Jeffrey Walton 2015-07-30 18:58:11 -04:00
parent da68ad21a2
commit e9c086aaac
1 changed files with 4 additions and 2 deletions

6
misc.h
View File

@ -379,8 +379,10 @@ template <class T1, class T2>
inline bool SafeConvert(T1 from, T2 &to)
{
to = (T2)from;
if (from != to || (from > 0) != (to > 0))
return false;
if (from != to || (from > 0) != (to > 0)) {
CRYPTOPP_ASSERT(false); return false;
}
return true;
}