The following issues were found

jstests/free_mon/libs/mock_http_control.py
3 issues
Unused import json
Error

Line: 7 Column: 1

              """

import argparse
import json
import logging
import sys
import urllib.request

import mock_http_common

            

Reported by Pylint.

Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Security blacklist

Line: 44
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen

                      print("Unknown query type")
        sys.exit(1)

    with urllib.request.urlopen(url_str) as f:
        print(f.read().decode('utf-8'))

    sys.exit(0)



            

Reported by Bandit.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 44 Column: 45

                      print("Unknown query type")
        sys.exit(1)

    with urllib.request.urlopen(url_str) as f:
        print(f.read().decode('utf-8'))

    sys.exit(0)



            

Reported by Pylint.

src/third_party/abseil-cpp-master/abseil-cpp/absl/hash/internal/city_test.cc
3 issues
syntax error
Error

Line: 584

                          CityHash64WithSeeds(data + offset, len, kSeed0, kSeed1));
}

TEST(CityHashTest, Unchanging) {
  setup();
  int i = 0;
  for (; i < kTestSize - 1; i++) {
    TestUnchanging(testdata[i], i * i, i);
  }

            

Reported by Cppcheck.

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

Line: 32 Column: 8 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

              static const int kDataSize = 1 << 20;
static const int kTestSize = 300;

static char data[kDataSize];

// Initialize data to pseudorandom values.
void setup() {
  uint64_t a = 9;
  uint64_t b = 777;

            

Reported by FlawFinder.

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

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

                  a = (a ^ (a >> 41)) * k0;
    b = (b ^ (b >> 41)) * k0 + i;
    uint8_t u = b >> 37;
    memcpy(data + i, &u, 1);  // uint8_t -> char
  }
}

#define C(x) 0x##x##ULL
static const uint64_t testdata[kTestSize][4] = {

            

Reported by FlawFinder.

src/mongo/db/exec/sbe/stages/loop_join.cpp
3 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: 90 Column: 21 CWE codes: 362

                  return _children[1]->getAccessor(ctx, slot);
}

void LoopJoinStage::open(bool reOpen) {
    auto optTimer(getOptTimer(_opCtx));

    _commonStats.opens++;
    _children[0]->open(reOpen);
    _outerGetNext = true;

            

Reported by FlawFinder.

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: 94 Column: 19 CWE codes: 362

                  auto optTimer(getOptTimer(_opCtx));

    _commonStats.opens++;
    _children[0]->open(reOpen);
    _outerGetNext = true;
    // Do not open the inner child as we do not have values of correlated parameters yet.
    // The values are available only after we call getNext on the outer side.
}


            

Reported by FlawFinder.

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: 102 Column: 19 CWE codes: 362

              
void LoopJoinStage::openInner() {
    // (re)open the inner side as it can see the correlated value now.
    _children[1]->open(_reOpenInner);
    _reOpenInner = true;
    ++_specificStats.innerOpens;
}

PlanState LoopJoinStage::getNext() {

            

Reported by FlawFinder.

src/third_party/abseil-cpp-master/abseil-cpp/absl/hash/hash_test.cc
3 issues
syntax error
Error

Line: 67

              template <typename T>
using is_hashable = std::is_default_constructible<absl::Hash<T>>;

TYPED_TEST_P(HashValueIntTest, BasicUsage) {
  EXPECT_TRUE((is_hashable<TypeParam>::value));

  TypeParam n = 42;
  EXPECT_EQ(SpyHash(n), SpyHash(TypeParam{42}));
  EXPECT_NE(SpyHash(n), SpyHash(TypeParam{0}));

            

Reported by Cppcheck.

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

Line: 861 Column: 12 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

                // Create equal StructWithPadding objects that are known to have non-equal
  // padding bytes.
  static const size_t kNumStructs = 10;
  unsigned char buffer1[kNumStructs * sizeof(StructWithPadding)];
  std::memset(buffer1, 0, sizeof(buffer1));
  auto* s1 = reinterpret_cast<StructWithPadding*>(buffer1);

  unsigned char buffer2[kNumStructs * sizeof(StructWithPadding)];
  std::memset(buffer2, 255, sizeof(buffer2));

            

Reported by FlawFinder.

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

Line: 865 Column: 12 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

                std::memset(buffer1, 0, sizeof(buffer1));
  auto* s1 = reinterpret_cast<StructWithPadding*>(buffer1);

  unsigned char buffer2[kNumStructs * sizeof(StructWithPadding)];
  std::memset(buffer2, 255, sizeof(buffer2));
  auto* s2 = reinterpret_cast<StructWithPadding*>(buffer2);
  for (int i = 0; i < kNumStructs; ++i) {
    SCOPED_TRACE(i);
    s1[i].c = s2[i].c = '0' + i;

            

Reported by FlawFinder.

src/third_party/abseil-cpp-master/abseil-cpp/absl/hash/hash_benchmark.cc
3 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 199 Column: 8 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

              // will allow us to attribute most time to CPU which means more accurate
// measurements.
static constexpr size_t kEntropySize = 16 << 10;
static char entropy[kEntropySize + 1024];
ABSL_ATTRIBUTE_UNUSED static const bool kInitialized = [] {
  absl::BitGen gen;
  static_assert(sizeof(entropy) % sizeof(uint64_t) == 0, "");
  for (int i = 0; i != sizeof(entropy); i += sizeof(uint64_t)) {
    auto rand = absl::Uniform<uint64_t>(gen);

            

Reported by FlawFinder.

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

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

                static_assert(sizeof(entropy) % sizeof(uint64_t) == 0, "");
  for (int i = 0; i != sizeof(entropy); i += sizeof(uint64_t)) {
    auto rand = absl::Uniform<uint64_t>(gen);
    memcpy(&entropy[i], &rand, sizeof(uint64_t));
  }
  return true;
}();
}  // namespace


            

Reported by FlawFinder.

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

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

              
  T Get(size_t i) const {
    T v;
    memcpy(&v, &entropy[i % kEntropySize], sizeof(T));
    return v;
  }
};

template <size_t N>

            

Reported by FlawFinder.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/hpcc.py
3 issues
Attempted relative import beyond top-level package
Error

Line: 37 Column: 1

              
import SCons.Util

from . import cc

def generate(env):
    """Add Builders and construction variables for aCC & cc to an Environment."""
    cc.generate(env)


            

Reported by Pylint.

Line too long (115/100)
Error

Line: 33 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Tool/hpcc.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import SCons.Util

from . import cc


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 1

                  env['CXX']        = 'aCC'
    env['SHCCFLAGS']  = SCons.Util.CLVar('$CCFLAGS +Z')

def exists(env):
    return env.Detect('aCC')

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/ilink.py
3 issues
Line too long (116/100)
Error

Line: 34 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Tool/ilink.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import SCons.Defaults
import SCons.Tool
import SCons.Util


            

Reported by Pylint.

Trailing whitespace
Error

Line: 43 Column: 1

              def generate(env):
    """Add Builders and construction variables for ilink to an Environment."""
    SCons.Tool.createProgBuilder(env)
    
    env['LINK']        = 'ilink'
    env['LINKFLAGS']   = SCons.Util.CLVar('')
    env['LINKCOM']     = '$LINK $LINKFLAGS /O:$TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
    env['LIBDIRPREFIX']='/LIBPATH:'
    env['LIBDIRSUFFIX']=''

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 52 Column: 1

                  env['LIBLINKPREFIX']=''
    env['LIBLINKSUFFIX']='$LIBSUFFIX'

def exists(env):
    return env.Detect('ilink')

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/gfortran.py
3 issues
Attempted relative import beyond top-level package
Error

Line: 39 Column: 1

              
import SCons.Util

from . import fortran

def generate(env):
    """Add Builders and construction variables for gfortran to an
    Environment."""
    fortran.generate(env)

            

Reported by Pylint.

Line too long (119/100)
Error

Line: 35 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Tool/gfortran.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import SCons.Util

from . import fortran


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 59 Column: 1

              
    env['FORTRANMODDIRPREFIX'] = "-J"

def exists(env):
    return env.Detect('gfortran')

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/gas.py
3 issues
No exception type(s) specified
Error

Line: 38 Column: 1

              
try:
    as_module = __import__('as', globals(), locals(), [])
except:
    as_module = __import__(__package__+'.as', globals(), locals(), ['*'])

assemblers = ['as', 'gas']

def generate(env):

            

Reported by Pylint.

Line too long (114/100)
Error

Line: 34 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Tool/gas.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

try:
    as_module = __import__('as', globals(), locals(), [])
except:
    as_module = __import__(__package__+'.as', globals(), locals(), ['*'])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 49 Column: 1

              
    env['AS']        = env.Detect(assemblers) or 'as'

def exists(env):
    return env.Detect(assemblers)

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil

            

Reported by Pylint.

src/third_party/abseil-cpp-master/abseil-cpp/absl/flags/internal/sequence_lock.h
3 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

                  char* dst_byte = static_cast<char*>(dst);
    while (size >= sizeof(uint64_t)) {
      uint64_t word = src->load(std::memory_order_relaxed);
      std::memcpy(dst_byte, &word, sizeof(word));
      dst_byte += sizeof(word);
      src++;
      size -= sizeof(word);
    }
    if (size > 0) {

            

Reported by FlawFinder.

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

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

                  }
    if (size > 0) {
      uint64_t word = src->load(std::memory_order_relaxed);
      std::memcpy(dst_byte, &word, size);
    }
  }

  // Perform the equivalent of "memcpy(dst, src, size)", but using relaxed
  // atomics.

            

Reported by FlawFinder.

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

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

                  }
    if (size > 0) {
      uint64_t word = 0;
      std::memcpy(&word, src_byte, size);
      dst->store(word, std::memory_order_relaxed);
    }
  }

  static constexpr int64_t kUninitialized = -1;

            

Reported by FlawFinder.