From 23bacf40c83b5545ec211de43dbd73963e4f2bb9 Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Thu, 3 May 2018 09:26:15 +0000 Subject: [PATCH] ICU-12572 Fixing undefined behavior in NullableValue assignment operator. X-SVN-Rev: 41318 --- icu4c/source/i18n/number_types.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/number_types.h b/icu4c/source/i18n/number_types.h index 909302480f..57da72f8aa 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;