[libcxx-commits] [libcxx] r352926 - add a test and a couple minor bug fixes for the implicit-signed-integer-truncation sanitizer. This is PR#40566

Marshall Clow via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 1 13:59:27 PST 2019


Author: marshall
Date: Fri Feb  1 13:59:27 2019
New Revision: 352926

URL: http://llvm.org/viewvc/llvm-project?rev=352926&view=rev
Log:
add a test and a couple minor bug fixes for the implicit-signed-integer-truncation sanitizer. This is PR#40566

Modified:
    libcxx/trunk/include/locale
    libcxx/trunk/include/sstream
    libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=352926&r1=352925&r2=352926&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Fri Feb  1 13:59:27 2019
@@ -546,7 +546,7 @@ __num_get<_CharT>::__stage2_float_loop(_
         __exp = 'P';
     else if ((__x & 0x5F) == __exp)
     {
-        __exp |= 0x80;
+        __exp |= (char) 0x80;
         if (__in_units)
         {
             __in_units = false;

Modified: libcxx/trunk/include/sstream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/sstream?rev=352926&r1=352925&r2=352926&view=diff
==============================================================================
--- libcxx/trunk/include/sstream (original)
+++ libcxx/trunk/include/sstream Fri Feb  1 13:59:27 2019
@@ -558,7 +558,7 @@ basic_stringbuf<_CharT, _Traits, _Alloca
             char_type* __p = const_cast<char_type*>(__str_.data());
             this->setg(__p, __p + __ninp, __hm_);
         }
-        return this->sputc(__c);
+        return this->sputc(traits_type::to_char_type(__c));
     }
     return traits_type::not_eof(__c);
 }

Modified: libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp?rev=352926&r1=352925&r2=352926&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp Fri Feb  1 13:59:27 2019
@@ -58,4 +58,9 @@ int main()
         ss << i << ' ' << 321;
         assert(ss.str() == L"89 3219 ");
     }
+    {
+        std::stringstream ss;
+        ss.write("\xd1", 1);
+        assert(ss.str().length() == 1);
+    }
 }




More information about the libcxx-commits mailing list