Bug 86163 - std::regex crashes when matching long lines
Summary: std::regex crashes when matching long lines
Status: RESOLVED DUPLICATE of bug 86164
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-15 10:45 UTC by Holger Seelig
Modified: 2018-06-15 11:12 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***