Skip to content

Out of bounds access with specially crafted regular expression #227

@alexsharoff

Description

@alexsharoff

Running the following program under debug gives an error xstring(1902) : Assertion failed: cannot dereference string iterator because it is out of range (e.g. an end iterator):

#include <boost/regex.hpp>
#include <string>

int main() {
   boost::regex rx("(*ACCEPT)*+\\1((*ACCEPT)*+\\K)");
   std::string str = "Z";
   boost::smatch what;
   boost::regex_search(str, what, rx, boost::match_default|boost::match_partial);
}

Tested on Windows, compiler: Visual Studio 2019.

The above regular expression was found via fuzzing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions