From: Shane Carr Date: Thu, 3 May 2018 09:26:15 +0000 (+0000) Subject: ICU-12572 Fixing undefined behavior in NullableValue assignment operator. X-Git-Tag: release-62-rc~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23bacf40c83b5545ec211de43dbd73963e4f2bb9;p=icu ICU-12572 Fixing undefined behavior in NullableValue assignment operator. X-SVN-Rev: 41318 --- diff --git a/icu4c/source/i18n/number_types.h b/icu4c/source/i18n/number_types.h index 909302480f1..57da72f8aa0 100644 --- a/icu4c/source/i18n/number_types.h +++ b/icu4c/source/i18n/number_types.h @@ -246,7 +246,13 @@ class U_I18N_API NullableValue { fNull = false; } - NullableValue& operator=(const NullableValue& other) = default; + NullableValue& operator=(const NullableValue& other) { + fNull = other.fNull; + if (!fNull) { + fValue = other.fValue; + } + return *this; + } NullableValue& operator=(const T& other) { fValue = other;