From: Markus Scherer Date: Thu, 17 Aug 2017 21:37:36 +0000 (+0000) Subject: ICU-13158 change range check to catch NaN X-Git-Tag: release-60-rc~183 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcb323c2e0d90adf84d8711a1ccd39e6308a942d;p=icu ICU-13158 change range check to catch NaN X-SVN-Rev: 40341 --- diff --git a/icu4c/source/common/uniset_props.cpp b/icu4c/source/common/uniset_props.cpp index 9f6480b5428..1c28a2d84c9 100644 --- a/icu4c/source/common/uniset_props.cpp +++ b/icu4c/source/common/uniset_props.cpp @@ -1011,7 +1011,9 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop, double value = uprv_strtod(vname.data(), &end); // Anything between 0 and 255 is valid even if unused. // Cast double->int only after range check. - if (*end != 0 || value < 0 || 255 < value || + // We catch NaN here because comparing it with both 0 and 255 will be false + // (as are all comparisons with NaN). + if (*end != 0 || !(0 <= value && value <= 255) || (v = (int32_t)value) != value) { // non-integral value or outside 0..255, or trailing junk FAIL(ec);