Commit 4c417d5a authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

Prevent a crash when client issues EXEC without MULTI

parent e5268c8c
Pipeline #467605 canceled with stages
in 30 minutes and 44 seconds
......@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
### Added
- Command `hclone` for creating identical copies of entire hashes.
### Fixed
- An `EXEC` when not inside a `MULTI` would cause a crash.
## 0.2.9 (2018-07-16)
### Added
- Commands `convert-string-to-int`, `convert-int-to-string` to convert between
......
Subproject commit 1ad54a7631b7a7e6db4c14fb4a33596b838724a6
Subproject commit 630fe4d17f673bfc476f10bbaf7b6ea82d0db0c3
......@@ -244,6 +244,12 @@ LinkStatus Connection::processRequests(Dispatcher *dispatcher, const InFlightTra
continue;
}
// EXEC without MULTI?
if(currentRequest.getCommand() == RedisCommand::EXEC && !multiHandler.active()) {
this->err("EXEC without MULTI");
continue;
}
if(currentRequest.getCommand() == RedisCommand::TX_READWRITE) {
multiHandler.finalizePhantomTransaction(dispatcher, this);
dispatcher->dispatch(this, currentRequest);
......
......@@ -117,6 +117,11 @@ TEST_F(Multi, HandlerBasicSanity) {
ASSERT_REPLY(replies[1], "QUEUED");
ASSERT_REPLY(replies[2], "OK");
ASSERT_REPLY(replies[3], "v1");
// EXEC without MULTI
replies.clear();
ASSERT_REPLY(tunnel(leaderID)->exec("EXEC"), "ERR EXEC without MULTI");
ASSERT_REPLY(tunnel(leaderID)->exec("HGET", "myhash", "f1"), "v1");
}
TEST_F(Multi, WithRaft) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment