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: several bugs #4500

Merged
merged 1 commit into from
Jan 24, 2025
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: 4 additions & 3 deletions src/core/dash.h
Original file line number Diff line number Diff line change
Expand Up @@ -947,12 +947,13 @@ auto DashTable<_Key, _Value, Policy>::GetRandomCursor(absl::BitGen* bitgen) -> C
template <typename _Key, typename _Value, typename Policy>
template <typename Cb>
auto DashTable<_Key, _Value, Policy>::Traverse(Cursor curs, Cb&& cb) -> Cursor {
if (curs.bucket_id() >= Policy::kBucketNum) // sanity.
return 0;

uint32_t sid = curs.segment_id(global_depth_);
uint8_t bid = curs.bucket_id();

// Test validity of the cursor.
if (bid >= Policy::kBucketNum || sid >= segment_.size())
return 0;

auto hash_fun = [this](const auto& k) { return policy_.HashFn(k); };

bool fetched = false;
Expand Down
5 changes: 5 additions & 0 deletions src/server/generic_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -872,4 +872,9 @@ TEST_F(GenericFamilyTest, RestoreOOM) {
EXPECT_THAT(resp, ErrArg("Out of memory"));
}

TEST_F(GenericFamilyTest, Bug4466) {
auto resp = Run({"SCAN","9223372036854775808"}); // an invalid cursor should not crash us.
EXPECT_THAT(resp, RespElementsAre("0", RespElementsAre()));
}

} // namespace dfly
1 change: 1 addition & 0 deletions src/server/script_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ABSL_FLAG(
std::vector<std::string>({
"351130589c64523cb98978dc32c64173a31244f3", // Sidekiq, see #2442
"6ae15ef4678593dc61f991c9953722d67d822776", // Sidekiq, see #2442
"34b1048274c8e50a0cc587a3ed9c383a82bb78c5" // Sidekiq
romange marked this conversation as resolved.
Show resolved Hide resolved
}),
"Comma-separated list of Lua script SHAs which are allowed to access undeclared keys. SHAs are "
"only looked at when loading the script, and new values do not affect already-loaded script.");
Expand Down
Loading