Skip to content

libFuzzer outputs that crash libc++'s regex engine #24785

Closed

Description

@mclow
Bugzilla Link 24411
Resolution FIXED
Resolved on Feb 07, 2019 14:19
Version unspecified
OS All
Attachments Input to crash regex_match
CC @kcc,@mclow

Extended Description

This bug is to record the results of fuzzing libc++'s regex with clang's libfuzzer.

When a crash is found, it will be added here.

Activity

  1. mclow commented on Aug 10, 2015

    @mclow
    ContributorAuthor

    assigned to @mclow

  2. mclow commented on Aug 10, 2015

    @mclow
    ContributorAuthor

    First crash - in regex_match. Using this target function

    extern "C" void LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
    if (size > 0)
    {
    try
    {
    std::regex::flag_type flag = std::regex_constants::grep;
    std::string s((const char *)data, size);
    std::regex re(s, flag);
    std::regex_match(s, re);
    }
    catch (std::regex_error &ex) {}
    }
    }

  3. mclow commented on Aug 24, 2015

    @mclow
    ContributorAuthor

    I reduced this test case down to "\8" and fixed it in 245849.

    Leaving the bug open b/c I think the fuzzer will find more.

  4. mclow commented on Aug 26, 2015

    @mclow
    ContributorAuthor

    Here's another one the uzzer found (simplified).
    This one doesn't fail, but it takes minutes to match against itself.

    const char bad = "#\(.\)*###################.######.####### ";

  5. kcc commented on Feb 10, 2017

    @kcc
    Contributor

    Is there still an interest in fuzzing libc++'s regex?
    We now have https://github.com/google/oss-fuzz, a continuous
    fuzzing service, where libc++ would be welcome.

    Fuzzing regex now yield this:
    projects/libcxx/include/regex:4058:21: runtime error: signed integer overflow: 403809844 * 10 cannot be represented in type 'int'

    and then quickly gets stuck in timeouts.

  6. mclow commented on Feb 7, 2019

    @mclow
    ContributorAuthor

    We have fixed all the regex crashes that OSS-Fuzz has reported.
    What's left is stack overflows, large memory usage, and timeouts.

    Closing this bug, because they're all being tracked over at OSS-Fuzz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillalibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions