summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarshall Clow <mclow@qualcomm.com>2013-03-22 02:13:55 +0000
committerMarshall Clow <mclow@qualcomm.com>2013-03-22 02:13:55 +0000
commit1c2c986796f1cd23ccdaf10ffe1a9e70c936b19c (patch)
treed879354b9e22ce6c0bf6b60779d0df151b8bfc04
parenteaef89b197e640785a1fdb167725359248f77720 (diff)
downloadbcm5719-llvm-1c2c986796f1cd23ccdaf10ffe1a9e70c936b19c.tar.gz
bcm5719-llvm-1c2c986796f1cd23ccdaf10ffe1a9e70c936b19c.zip
Fix undefined behavior in syntax_option_type::operator~ and match_flag_type::operator./a.out Found by UBSan
llvm-svn: 177693
-rw-r--r--libcxx/include/regex4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 1156a3e5335..d1afa54a894 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -764,7 +764,7 @@ _LIBCPP_CONSTEXPR
syntax_option_type
operator~(syntax_option_type __x)
{
- return syntax_option_type(~int(__x));
+ return syntax_option_type(~int(__x) & 0x1FF);
}
inline _LIBCPP_INLINE_VISIBILITY
@@ -840,7 +840,7 @@ _LIBCPP_CONSTEXPR
match_flag_type
operator~(match_flag_type __x)
{
- return match_flag_type(~int(__x));
+ return match_flag_type(~int(__x) & 0x0FFF);
}
inline _LIBCPP_INLINE_VISIBILITY
OpenPOWER on IntegriCloud