The following issues were found

buildscripts/util/testname.py
1 issues
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 20
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  Note: This method uses ':' to separate the test name from the resmoke hook name. If the test
    name has a ':' in it (such as burn_in_test.py tests), it will not work correctly.
    """
    assert is_resmoke_hook(hook_name) is True

    hook_name_parts = hook_name.split(HOOK_DELIMITER)

    return hook_name_parts[0], hook_name_parts[1]


            

Reported by Bandit.

etc/format_sample.cpp
1 issues
syntax error: 7 =
Error

Line: 101

                  // SpaceBeforeParens: False
    if (argWithLongName == 0) {  // Comment: SpacesBeforeTrailingComments
        // Do something
    } else if (b % 7 = 3) {
    }  // some weird trailing else comment that clang-format does not touch
    else {
        // Notice the indent around else
    }


            

Reported by Cppcheck.

jstests/free_mon/libs/mock_http_common.py
1 issues
Too few public methods (1/2)
Error

Line: 11 Column: 1

              URL_ENABLE_FAULTS = "/enable_faults"


class Stats:
    """Stats class shared between client and server."""

    def __init__(self):
        self.register_calls = 0
        self.metrics_calls = 0

            

Reported by Pylint.

site_scons/site_tools/dagger/graph_consts.py
1 issues
String statement has no effect
Error

Line: 24 Column: 1

              #

"""Constants for use in graph.py and dagger.py"""
"""Relationship edge types"""
LIB_LIB = 1
LIB_FIL = 2
FIL_LIB = 3
FIL_FIL = 4
FIL_SYM = 5

            

Reported by Pylint.

src/mongo/base/clonable_ptr_test.cpp
1 issues
syntax error
Error

Line: 177

                  }
};

TEST(ClonablePtrTest, syntax_smoke_test) {
// TODO: Either add a compressed pair type for optimization, or wait for MSVC to get this feature by
//       default.  MSVC doesn't make its tuple compressed, which causes this test to fail on MSVC.
#ifndef _MSC_VER
    {
        mongo::clonable_ptr<ClonableTest> p;

            

Reported by Cppcheck.

src/mongo/base/data_type_string_data.cpp
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 72 Column: 14 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                  }

    if (ptr) {
        std::memcpy(ptr, sdata.rawData(), sdata.size());
    }

    if (advanced) {
        *advanced = sdata.size();
    }

            

Reported by FlawFinder.

src/mongo/base/data_type_string_data_test.cpp
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 40 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              namespace mongo {

TEST(DataTypeStringData, Basic) {
    char buf[100];
    StringData a("a");
    StringData b("bb");
    StringData c("ccc");

    {

            

Reported by FlawFinder.

src/mongo/base/data_type_terminated.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 52 Column: 50 CWE codes: 120 20

              struct TerminatedHelper {
    static Status makeLoadNoTerminalStatus(char c, size_t length, std::ptrdiff_t debug_offset);
    static Status makeLoadShortReadStatus(char c,
                                          size_t read,
                                          size_t length,
                                          std::ptrdiff_t debug_offset);
    static Status makeStoreStatus(char c, size_t length, std::ptrdiff_t debug_offset);
};


            

Reported by FlawFinder.

src/mongo/base/data_view.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 59 Column: 7 CWE codes: 120 20

                  }

    template <typename T>
    T read(std::ptrdiff_t offset = 0) const {
        T t(DataType::defaultConstruct<T>());

        readInto(&t, offset);

        return t;

            

Reported by FlawFinder.

src/mongo/base/dependency_graph_test.cpp
1 issues
syntax error
Error

Line: 52

                  return std::count(c.begin(), c.end(), value);
}

TEST(DependencyGraphTest, InsertNullPayloadOkay) {
    DependencyGraph graph;
    graph.addNode("A", {}, {});
}

TEST(DependencyGraphTest, InsertSameNameTwiceFails) {

            

Reported by Cppcheck.