#2022 closed Bugs (invalid)
Found crash of boost for characters ' * ' , ' a* ' , & " abc** "
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | Component: | regex | |
Version: | Boost 1.34.0 | Severity: | Showstopper |
Keywords: | Cc: |
Description
Hi, I have found crash of Boost Regex Library whenever I give search Pattern '*' or 'a*' or 'abc' i.e. multiple occurence of * My code is like this:
#include "GrepWrapper.h" #include <stdio.h> using namespace std; char pattern[] =
"aa moduladfe=message&_action=view5080|" "*|" "*GET|" "ya|" "tarewq*|" ;
char buf[] =
"GET" "yaaaa" "GET";
int main(int argc, char argv) {
int nRetValue = 0; CGrepWrapper objGrepWrapper; objGrepWrapper.SetSearchPattern(pattern);
ACE_Vector<std::string> vOutputVector; nRetValue = objGrepWrapper.ApplyFilter(buf, 10, vOutputVector, true); int nVectorLen = vOutputVector.size(); if (nVectorLen > 0) {
for (int i = 0 ; i < nVectorLen; i++) {
printf("\t%s", vOutputVector[i].c_str()); vOutputVector.pop_back();
}
} else {
printf("\nNot Found");
}
return 0;
}
Neither "*" nor "abc" are valid regular expressions: as a result Boost.Regex will throw a boost::regex_error exception. It's up to you to catch the exception, if you don't then the program *will* terminate with an uncaught exception error. This behaviour is intentional.
HTH, John Maddock.