Skip to content

Commit

Permalink
Fix passing around an uninitialized struct member (#13744)
Browse files Browse the repository at this point in the history
Fix potentially undefined behavior when creating a CalculationTransactionContext
for an arangosearch analyzer. An uninitialized struct member was passed as an
argument to its base class. This potentially had no observable effects, but
should be fixed.
  • Loading branch information
jsteemann authored Mar 18, 2021
1 parent 76c302d commit 3aacae4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
devel
-----

* Fix potentially undefined behavior when creating a CalculationTransactionContext
for an arangosearch analyzer. An uninitialized struct member was passed as an
argument to its base class. This potentially had no observable effects, but
should be fixed.

* Retry a cluster internal network request if the connection comes from the
pool and turns out to be stale (connection immediately closed). This fixes
some spurious errors after a hotbackup restore.
Expand Down
7 changes: 2 additions & 5 deletions arangod/IResearch/IResearchAqlAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ bool normalize_slice(VPackSlice const& slice, VPackBuilder& builder) {
return false;
}

/// @brief Dummmy transaction state which does nothing but provides valid
/// @brief Dummy transaction state which does nothing but provides valid
/// statuses to keep ASSERT happy
class CalculationTransactionState final : public arangodb::TransactionState {
public:
explicit CalculationTransactionState(TRI_vocbase_t& vocbase)
: TransactionState(vocbase, arangodb::TransactionId(0), _options) {
: TransactionState(vocbase, arangodb::TransactionId(0), arangodb::transaction::Options()) {
updateStatus(arangodb::transaction::Status::RUNNING); // always running to make ASSERTS happy
}

Expand Down Expand Up @@ -177,9 +177,6 @@ class CalculationTransactionState final : public arangodb::TransactionState {

/// @brief number of commits, including intermediate commits
uint64_t numCommits() const override { return 0; }

private:
arangodb::transaction::Options _options;
};

/// @brief Dummy transaction context which just gives dummy state
Expand Down

0 comments on commit 3aacae4

Please sign in to comment.