The following issues were found

src/third_party/abseil-cpp-master/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 107 Column: 3 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

                int offset_hours = offset_minutes / 60;
  offset_minutes %= 60;
  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
  char buf[prefix_len + sizeof("-24:00:00")];
  char* ep = std::copy(kFixedZonePrefix, kFixedZonePrefix + prefix_len, buf);
  *ep++ = sign;
  ep = Format02d(ep, offset_hours);
  *ep++ = ':';
  ep = Format02d(ep, offset_minutes);

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 65 Column: 13 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                const char* const ep = kFixedZonePrefix + prefix_len;
  if (name.size() != prefix_len + 9)  // <prefix>+99:99:99
    return false;
  if (!std::equal(kFixedZonePrefix, ep, name.begin())) return false;
  const char* np = name.data() + prefix_len;
  if (np[0] != '+' && np[0] != '-') return false;
  if (np[3] != ':' || np[6] != ':')  // see note below about large offsets
    return false;


            

Reported by FlawFinder.

src/mongo/embedded/embedded.cpp
2 issues
srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 191 Column: 5 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              

ServiceContext* initialize(const char* yaml_config) {
    srand(static_cast<unsigned>(curTimeMicros64()));

    if (yaml_config)
        embedded::EmbeddedOptionsConfig::instance().set(yaml_config);

    Status status = mongo::runGlobalInitializers(std::vector<std::string>{});

            

Reported by FlawFinder.

srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 319 Column: 5 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                  }

    // This is for security on certain platforms (nonce generation)
    srand((unsigned)(curTimeMicros64()) ^ (unsigned(uintptr_t(&startupOpCtx))));

    // Set up the logical session cache
    LogicalSessionCache::set(serviceContext,
                             std::make_unique<LogicalSessionCacheImpl>(
                                 std::make_unique<ServiceLiaisonMongod>(),

            

Reported by FlawFinder.

src/third_party/abseil-cpp-master/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 341 Column: 3 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

                const std::tm tm = ToTM(al);

  // Scratch buffer for internal conversions.
  char buf[3 + kDigits10_64];  // enough for longest conversion
  char* const ep = buf + sizeof(buf);
  char* bp;  // works back from ep

  // Maintain three, disjoint subsequences that span format.
  //   [format.begin() ... pending) : already formatted into result

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 66 Column: 25 CWE codes: 126

                input >> std::get_time(tm, fmt);
  if (input.fail()) return nullptr;
  return const_cast<char*>(s) +
         (input.eof() ? strlen(s) : static_cast<std::size_t>(input.tellg()));
}
#endif

// Convert a cctz::weekday to a tm_wday value (0-6, Sunday = 0).
int ToTmWday(weekday wd) {

            

Reported by FlawFinder.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_tgamma.c
2 issues
Shifting 32-bit value by 53 bits is undefined behaviour
Error

Line: 147 CWE codes: 758

              // If the exponent is -ve then |x| < 10^6, so adding to 2 * 10^6 will
// give something with exactly the complement of digits.

  e = (((x_int & (3ull<<61)) == (3ull<<61)) ? (x_int >> 51) : (x_int >> 53)) &
      ((1ull<<10)-1);
  if (e <= 398)
   { if (e < 398)
      { BID_UINT64 localshifter = BID64_SHIFTER;
        BIDECIMAL_CALL2 (bid64_add, x_int, localshifter, x_int);

            

Reported by Cppcheck.

Shifting 32-bit value by 51 bits is undefined behaviour
Error

Line: 147 CWE codes: 758

              // If the exponent is -ve then |x| < 10^6, so adding to 2 * 10^6 will
// give something with exactly the complement of digits.

  e = (((x_int & (3ull<<61)) == (3ull<<61)) ? (x_int >> 51) : (x_int >> 53)) &
      ((1ull<<10)-1);
  if (e <= 398)
   { if (e < 398)
      { BID_UINT64 localshifter = BID64_SHIFTER;
        BIDECIMAL_CALL2 (bid64_add, x_int, localshifter, x_int);

            

Reported by Cppcheck.

src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp
2 issues
syntax error
Error

Line: 207

                  mongo_embedded_v1_instance* db;
};

TEST_F(MongodbCAPITest, CreateAndDestroyDB) {
    // Test the setUp() and tearDown() test fixtures
}

TEST_F(MongodbCAPITest, CreateAndDestroyDBAndClient) {
    auto client = createClient();

            

Reported by Cppcheck.

memcpy - Does not check for buffer overflows when copying to destination
Security

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

              
    mongo::Message messageFromBuffer(void* data, size_t dataLen) {
        auto sb = mongo::SharedBuffer::allocate(dataLen);
        memcpy(sb.get(), data, dataLen);
        mongo::Message msg(std::move(sb));
        return msg;
    }

    mongo::BSONObj performRpc(MongoDBCAPIClientPtr& client, mongo::OpMsgRequest request) {

            

Reported by FlawFinder.

src/third_party/boost/boost/algorithm/string/find_iterator.hpp
2 issues
equal - Function does not check the second iterator for over-read conditions
Security

Line: 139 Column: 18 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                          }

            // comparison
            bool equal( const find_iterator& Other ) const
            {
                bool bEof=eof();
                bool bOtherEof=Other.eof();

                return bEof || bOtherEof ? bEof==bOtherEof :

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 326 Column: 18 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                          }

            // comparison
            bool equal( const split_iterator& Other ) const
            {
                bool bEof=eof();
                bool bOtherEof=Other.eof();

                return bEof || bOtherEof ? bEof==bOtherEof :

            

Reported by FlawFinder.

src/mongo/db/mongod_main.cpp
2 issues
srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 535 Column: 5 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                  }

    // This is for security on certain platforms (nonce generation)
    srand((unsigned)(curTimeMicros64()) ^ (unsigned(uintptr_t(&startupOpCtx))));

    if (globalAuthzManager->shouldValidateAuthSchemaOnStartup()) {
        Status status = verifySystemIndexes(startupOpCtx.get());
        if (!status.isOK()) {
            LOGV2_WARNING(20538,

            

Reported by FlawFinder.

srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 1422 Column: 5 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              
    setupSignalHandlers();

    srand(static_cast<unsigned>(curTimeMicros64()));

    Status status = mongo::runGlobalInitializers(std::vector<std::string>(argv, argv + argc));
    if (!status.isOK()) {
        LOGV2_FATAL_OPTIONS(
            20574,

            

Reported by FlawFinder.

src/mongo/util/errno_util.cpp
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 61 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

                      errNumber = errno;
#endif

    char buf[kBuflen];
    char* msg{nullptr};

#if defined(__GNUC__) && defined(_GNU_SOURCE) && \
    (!defined(__ANDROID_API__) || !(__ANDROID_API__ <= 22)) && !defined(EMSCRIPTEN)
    msg = strerror_r(errNumber, buf, kBuflen);

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

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

                          size = kBuflen - 1;
        }

        memcpy(buf, utf8ErrorText.c_str(), size);
        buf[size] = '\0';
        msg = buf;
    } else if (strerror_s(buf, kBuflen, errNumber) != 0) {
        msg = buf;
    }

            

Reported by FlawFinder.

src/third_party/abseil-cpp-master/abseil-cpp/absl/debugging/internal/stack_consumption_test.cc
2 issues
syntax error
Error

Line: 40

                }
}

TEST(SignalHandlerStackConsumptionTest, MeasuresStackConsumption) {
  // Our handler should consume reasonable number of bytes.
  EXPECT_GE(GetSignalHandlerStackConsumption(SimpleSignalHandler), 100);
}

}  // namespace

            

Reported by Cppcheck.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 31 Column: 3 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 {

static void SimpleSignalHandler(int signo) {
  char buf[100];
  memset(buf, 'a', sizeof(buf));

  // Never true, but prevents compiler from optimizing buf out.
  if (signo == 0) {
    ABSL_RAW_LOG(INFO, "%p", static_cast<void*>(buf));

            

Reported by FlawFinder.

src/third_party/abseil-cpp-master/abseil-cpp/absl/debugging/internal/vdso_support.cc
2 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 79 Column: 14 CWE codes: 362

                }
#endif  // __GLIBC_PREREQ(2, 16)
  if (vdso_base_.load(std::memory_order_relaxed) == kInvalidBase) {
    int fd = open("/proc/self/auxv", O_RDONLY);
    if (fd == -1) {
      // Kernel too old to have a VDSO.
      vdso_base_.store(nullptr, std::memory_order_relaxed);
      getcpu_fn_.store(&GetCPUViaSyscall, std::memory_order_relaxed);
      return nullptr;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 87 Column: 12 CWE codes: 120 20

                    return nullptr;
    }
    ElfW(auxv_t) aux;
    while (read(fd, &aux, sizeof(aux)) == sizeof(aux)) {
      if (aux.a_type == AT_SYSINFO_EHDR) {
        vdso_base_.store(reinterpret_cast<void *>(aux.a_un.a_val),
                         std::memory_order_relaxed);
        break;
      }

            

Reported by FlawFinder.