Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mclow opened this issue Aug 10, 2015 · 6 comments
Closed

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

mclow opened this issue Aug 10, 2015 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@mclow
Copy link
Contributor

mclow commented Aug 10, 2015

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.

@mclow
Copy link
Contributor Author

mclow commented Aug 10, 2015

assigned to @mclow

@mclow
Copy link
Contributor Author

mclow commented Aug 10, 2015

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) {}
}
}

@mclow
Copy link
Contributor Author

mclow commented Aug 24, 2015

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.

@mclow
Copy link
Contributor Author

mclow commented Aug 26, 2015

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

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

@kcc
Copy link
Contributor

kcc commented Feb 10, 2017

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.

@mclow
Copy link
Contributor Author

mclow commented Feb 7, 2019

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.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants