-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[bug] Crash in String Matcher #2931
Comments
I can't reproduce this locally, nor on CE. Are you sure that the segfault comes from the StringMatcher? |
I'm still working on it (with breaks), but I did some tests and I'm not still sure about it. Note, I use C++20. I'm redirecting ostream: class StreamBufSentry {
std::ostream& ostream;
std::streambuf* rdbufBak;
public:
~StreamBufSentry() { ostream.rdbuf(rdbufBak); }
StreamBufSentry(StreamBufSentry const&) = delete;
StreamBufSentry(StreamBufSentry&&) = delete;
StreamBufSentry(std::ostream& ostream)
: ostream{ ostream }
, rdbufBak{ ostream.rdbuf() }
{
}
}; and using it: ...
extern std::string_view const ActuatorLengthCsvSV; // test_csv_data.cpp
...
...
StreamBufSentry sentry{ std::cout };
std::ostringstream os;
std::cout.rdbuf(os.rdbuf());
CsvReader<double> csvReader{};
...
csvReader.readFile(...);
std::cout << csvReader << '\n';
...
std::string const expected_str{ ActuatorLengthCsvSV };
REQUIRE_THAT(expected_str, Matches(os.str())); // boom
...
)
// test_csv_data.cpp
constexpr std::string_view const ActuatorLengthCsvSV = R"(0,0.999994607194946,....)"; |
I'll try to reduce it to a compile-able file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The following
works as expected. If I get a bigger expected string (e.g. ~110kByte) it crashes with
The problem is related to the
Matches
matcher - the following doesn't crash:Expected behavior
I must not crash in that way, even I've a try/catch block/scope!
Reproduction steps
See above.
Platform information:
Additional context
The text was updated successfully, but these errors were encountered: