Closed simsong closed 7 months ago
Yay! This makes std::regex hang:
rv.clear();
rv.push_back("[a-z]*@company.com");
/* Make a 32MB array to search */
std::string bigstring = std::string(1024*1024*30,'a') + " user@company.com " + std::string(1024*1024*2,'b');
found="";
size_t offset = 0;
size_t len = 0;
REQUIRE(rv.search_all(bigstring, &found, &offset, &len) == true);
REQUIRE(found == "user@company.com");
REQUIRE(offset == 1024*1024*30+2);
REQUIRE(len == 16 );
This only hangs for 60 seconds, then it crashes:
Yay! This makes std::regex hang:
rv.clear();
rv.push_back("[a-z]*@company.com");
/* Make a 32MB array to search */
std::string bigstring = std::string(1024*1024*30,'a') + " user@company.com " + std::string(1024*1024*2,'b');
found="";
size_t offset = 0;
size_t len = 0;
alarm(60);
REQUIRE(rv.search_all(bigstring, &found, &offset, &len) == true);
alarm(0);
REQUIRE(found == "user@company.com");
REQUIRE(offset == 1024*1024*30+2);
REQUIRE(len == 16 );