The following issues were found
src/mongo/db/exec/sbe/stages/traverse.h
1 issues
Line: 83
Column: 10
CWE codes:
362
void prepare(CompileCtx& ctx) final;
value::SlotAccessor* getAccessor(CompileCtx& ctx, value::SlotId slot) final;
void open(bool reOpen) final;
PlanState getNext() final;
void close() final;
std::unique_ptr<PlanStageStats> getStats(bool includeDebugInfo) const final;
const SpecificStats* getSpecificStats() const final;
Reported by FlawFinder.
src/mongo/db/exec/sbe/stages/unique.h
1 issues
Line: 62
Column: 10
CWE codes:
362
void prepare(CompileCtx& ctx) final;
value::SlotAccessor* getAccessor(CompileCtx& ctx, value::SlotId slot) final;
void open(bool reOpen) final;
PlanState getNext() final;
void close() final;
std::unique_ptr<PlanStageStats> getStats(bool includeDebugInfo) const final;
const SpecificStats* getSpecificStats() const final;
Reported by FlawFinder.
src/mongo/db/exec/sbe/stages/unwind.h
1 issues
Line: 61
Column: 10
CWE codes:
362
void prepare(CompileCtx& ctx) final;
value::SlotAccessor* getAccessor(CompileCtx& ctx, value::SlotId slot) final;
void open(bool reOpen) final;
PlanState getNext() final;
void close() final;
std::unique_ptr<PlanStageStats> getStats(bool includeDebugInfo) const final;
const SpecificStats* getSpecificStats() const final;
Reported by FlawFinder.
src/mongo/db/exec/sort_test.cpp
1 issues
Line: 169
ServiceContext::UniqueOperationContext _opCtx;
};
TEST_F(SortStageDefaultTest, SortEmptyWorkingSet) {
WorkingSet ws;
auto expCtx = make_intrusive<ExpressionContext>(opCtx(), nullptr, kNss);
// QueuedDataStage will be owned by SortStageDefault.
Reported by Cppcheck.
src/mongo/db/exec/working_set_test.cpp
1 issues
Line: 67
WorkingSetMember* member;
};
TEST_F(WorkingSetFixture, noFieldToGet) {
BSONElement elt;
// Make sure we're not getting anything out of an invalid WSM.
ASSERT_EQUALS(WorkingSetMember::INVALID, member->getState());
ASSERT_FALSE(member->getFieldDotted("foo", &elt));
Reported by Cppcheck.
src/mongo/db/exhaust_cursor_currentop_integration_test.cpp
1 issues
Line: 217
}
} // namespace
TEST(CurrentOpExhaustCursorTest, CanSeeEachExhaustCursorPseudoGetMoreInCurrentOpOutput) {
auto conn = connect();
// We need to set failpoints around getMore which cause it to hang, so only test against a
// single server rather than a replica set or mongoS.
if (conn->isReplicaSetMember() || conn->isMongos()) {
Reported by Cppcheck.
src/mongo/db/explain_test.cpp
1 issues
Line: 50
ASSERT_EQ(explain::Verbosity_serializer(Verbosity::kExecAllPlans), "allPlansExecution"_sd);
}
TEST(ExplainTest, ExplainSerializeToBSONCorrectly) {
ASSERT_BSONOBJ_EQ(BSON("verbosity"
<< "queryPlanner"),
ExplainOptions::toBSON(Verbosity::kQueryPlanner));
ASSERT_BSONOBJ_EQ(BSON("verbosity"
<< "executionStats"),
Reported by Cppcheck.
src/mongo/db/field_parser_test.cpp
1 issues
Line: 98
BSONField<OID> ExtractionFixture::anOID("anOID");
BSONField<long long> ExtractionFixture::aLong("aLong");
TEST_F(ExtractionFixture, GetBool) {
BSONField<bool> notThere("otherBool", true);
BSONField<bool> wrongType(anObj.name());
bool val;
ASSERT_TRUE(FieldParser::extract(doc, aBool, &val));
ASSERT_EQUALS(val, valBool);
Reported by Cppcheck.
src/mongo/db/field_ref_set_test.cpp
1 issues
Line: 60
ASSERT_EQUALS(static_cast<const FieldRef*>(nullptr), conflict);
}
TEST(EmptySet, Conflict) {
// insert "a.b"
FieldRefSet fieldSet;
FieldRef aDotB("a.b");
const FieldRef* conflict;
ASSERT_TRUE(fieldSet.insert(&aDotB, &conflict));
Reported by Cppcheck.
src/mongo/db/field_ref_test.cpp
1 issues
Line: 48
ASSERT_EQUALS(fieldRef.dottedField(), "");
}
TEST(Empty, NoFieldNames) {
std::string field = ".";
FieldRef fieldRef(field);
ASSERT_EQUALS(fieldRef.numParts(), 2U);
ASSERT_EQUALS(fieldRef.getPart(0), "");
ASSERT_EQUALS(fieldRef.getPart(1), "");
Reported by Cppcheck.