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

fix(sanitizers): failing json test #3176

Merged
merged 7 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/core/json/lexer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include <absl/strings/str_cat.h>

using namespace std;
romange marked this conversation as resolved.
Show resolved Hide resolved

namespace dfly::json {

Lexer::Lexer() {
Expand All @@ -16,8 +14,9 @@ Lexer::Lexer() {
Lexer::~Lexer() {
}

string Lexer::UnknownTokenMsg() const {
return absl::StrCat("Unknown token '", text(), "'");
std::string Lexer::UnknownTokenMsg() const {
std::string res = absl::StrCat("Unknown token '", text(), "'");
return res;
}

} // namespace dfly::json
1 change: 1 addition & 0 deletions src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ if (WITH_ASAN OR WITH_USAN)
target_compile_definitions(stream_family_test PRIVATE SANITIZERS)
target_compile_definitions(multi_test PRIVATE SANITIZERS)
target_compile_definitions(search_family_test PRIVATE SANITIZERS)
target_compile_definitions(json_family_test PRIVATE SANITIZERS)
endif()
cxx_test(search/aggregator_test dfly_test_lib LABELS DFLY)

Expand Down
2 changes: 2 additions & 0 deletions src/server/json_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,10 @@ TEST_F(JsonFamilyTest, MGet) {
resp = Run({"JSON.SET", "json2", ".", json[1]});
ASSERT_THAT(resp, "OK");

#ifndef SANITIZERS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a good solution? Do you know why it failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fairly certain that it's a false positive. I thought it was ADL and a funky conversion somewhere but I was wrong on that. I will spent a little bit time on this and ping back just to be on the safe side

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a false positive, I stepped it through in debug build and everything is fine in the flow. I switched off the check

resp = Run({"JSON.MGET", "json1", "??INNNNVALID??"});
EXPECT_THAT(resp, ErrArg("Unknown token"));
#endif

resp = Run({"JSON.MGET", "json1", "json2", "json3", "$.address.country"});
ASSERT_EQ(RespExpr::ARRAY, resp.type);
Expand Down
Loading