Skip to content

Commit

Permalink
Let's jsut make this a PCRE2 change
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerkaraszewski committed Jul 24, 2024
1 parent 147b5dd commit f7a9b88
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 3 additions & 6 deletions libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
#endif
#endif

#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h> // sudo apt-get install libpcre2-dev
//#define PCRE2_CODE_UNIT_WIDTH 8
//#include <pcre2.h> // sudo apt-get install libpcre2-dev
#include <pcrecpp.h> // sudo apt-get install libpcre++-dev

// Common error definitions
#define S_errno errno
Expand Down Expand Up @@ -2810,10 +2811,6 @@ bool SREMatch(const string& regExp, const string& s) {
return pcrecpp::RE(regExp, pcrecpp::RE_Options().set_match_limit_recursion(1000)).FullMatch(s);
}

bool SREMatch(const string& regExp, const string& s, string& match) {
return pcrecpp::RE(regExp, pcrecpp::RE_Options().set_match_limit_recursion(1000)).FullMatch(s, &match);
}

void SRedactSensitiveValues(string& s) {
// This code removing authTokens is a quick fix and should be removed once https://github.com/Expensify/Expensify/issues/144185 is done.
// The message may be truncated midway through the authToken, so there may not be a closing quote (") at the end of
Expand Down
1 change: 0 additions & 1 deletion libstuff/libstuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ bool SConstantTimeIEquals(const string& secret, const string& userInput);

// Perform a full regex match. The '^' and '$' symbols are implicit.
bool SREMatch(const string& regExp, const string& s);
bool SREMatch(const string& regExp, const string& s, string& match);

// Redact values that should not be logged.
void SRedactSensitiveValues(string& s);
Expand Down
7 changes: 3 additions & 4 deletions test/clustertest/tests/BadCommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#include <test/clustertest/BedrockClusterTester.h>

struct BadCommandTest : tpunit::TestFixture {
BadCommandTest() : tpunit::TestFixture("BadCommand") {
registerTests(TEST(BadCommandTest::test));
}
BadCommandTest()
: tpunit::TestFixture("BadCommand", TEST(BadCommandTest::test)) { }

void test()
{
Expand Down Expand Up @@ -47,7 +46,7 @@ struct BadCommandTest : tpunit::TestFixture {
// This tests cases where keeping leader alive isn't feasible.
bool testFailed = false;
for (auto commandName : {"generatesegfaultpeek", "generateassertpeek", "generatesegfaultprocess"}) {

// Create the command with the current userID.
userID++;
SData command(commandName);
Expand Down

0 comments on commit f7a9b88

Please sign in to comment.