- Fix (nt)intsafe.h signed to unsigned conversions. Based on a patch by Timo.
CORE-7578 #resolve

svn path=/trunk/; revision=60993
This commit is contained in:
Thomas Faber 2013-11-14 21:44:47 +00:00
parent 0ecfcc1bce
commit 9f96a991c1

View file

@ -343,7 +343,8 @@ INTSAFE_NAME(_Name)( \
_In_ _TypeFrom Input, \
_Out_ _Deref_out_range_(==, Input) _TypeTo *pOutput) \
{ \
if ((Input >= 0) && ((_TypeTo)Input <= _TypeTo ## _MAX)) \
if ((Input >= 0) && \
((sizeof(_TypeFrom) <= sizeof(_TypeTo)) || (Input <= (_TypeFrom)_TypeTo ## _MAX))) \
{ \
*pOutput = (_TypeTo)Input; \
return INTSAFE_SUCCESS; \