Bug 86163

Summary: std::regex crashes when matching long lines
Product: gcc Reporter: Holger Seelig <holger.seelig>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.1.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Holger Seelig 2018-06-15 10:45:05 UTC
std::regex crashes when matching long lines.

Here is an example:


#include <regex>
#include <iostream>
 
int main()
{
    std::string s (100'000, '*');
    std::smatch m;
    std::regex r ("^(.*?)$");

    std::regex_search (s, m, r);

    std::cout << s .substr (0, 10) << std::endl;
    std::cout << m  .str (1) .substr (0, 10) << std::endl;
}
Comment 1 ktkachov 2018-06-15 11:12:42 UTC
Dup.

*** This bug has been marked as a duplicate of bug 86164 ***