[libcxx] r258107 - Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed as http://reviews.llvm.org/D16262

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 18 16:50:37 PST 2016


Author: marshall
Date: Mon Jan 18 18:50:37 2016
New Revision: 258107

URL: http://llvm.org/viewvc/llvm-project?rev=258107&view=rev
Log:
Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed as http://reviews.llvm.org/D16262

Modified:
    libcxx/trunk/include/regex
    libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp

Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=258107&r1=258106&r2=258107&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Mon Jan 18 18:50:37 2016
@@ -4265,6 +4265,9 @@ basic_regex<_CharT, _Traits>::__parse_at
     if (__first != __last && *__first == '\\')
     {
         _ForwardIterator __t1 = _VSTD::next(__first);
+        if (__t1 == __last)
+            __throw_regex_error<regex_constants::error_escape>();
+
         _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
         if (__t2 != __t1)
             __first = __t2;

Modified: libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp?rev=258107&r1=258106&r2=258107&view=diff
==============================================================================
--- libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp (original)
+++ libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp Mon Jan 18 18:50:37 2016
@@ -33,6 +33,7 @@ int main()
 {
     assert(error_escape_thrown("[\\a]"));
     assert(error_escape_thrown("\\a"));
+    assert(error_escape_thrown("\\"));
 
     assert(error_escape_thrown("[\\e]"));
     assert(error_escape_thrown("\\e"));




More information about the cfe-commits mailing list