The following issues were found

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_tan.c
9 issues
Shifting 32-bit value by 63 bits is undefined behaviour
Error

Line: 12440 CWE codes: 758

              
// Decompose the input and check for NaN and infinity.

  s = x.w[BID_HIGH_128W] >> 63;
  if ((x.w[BID_HIGH_128W] & (3ull<<61)) == (3ull<<61))
   { if ((x.w[BID_HIGH_128W] & (0xFull<<59)) == (0xFull<<59))
      { if ((x.w[BID_HIGH_128W] & (0x1Full<<58)) != (0x1Full<<58))
         { // input is infinite, so return NaN
           #ifdef BID_SET_STATUS_FLAGS

            

Reported by Cppcheck.

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

Line: 12478 CWE codes: 758

                 }
  else
   { // "small coefficient" input, the normal case for finite numbers
     e = ((x.w[BID_HIGH_128W] >> 49) & ((1ull<<14)-1)) - 6176;
     c.w[1] = x.w[BID_HIGH_128W] & ((1ull<<49)-1);
     c.w[0] = x.w[BID_LOW_128W];
     if (lt128(542101086242752ull,4003012203950112767ull,c.w[1],c.w[0]))
      { c.w[1] = 0ull; c.w[0] = 0ull; }
   }

            

Reported by Cppcheck.

Array 'bid_decimal128_moduli[6147]' accessed at index -18, which is out of bounds.
Error

Line: 12513 CWE codes: 786

              // Pick out the appropriate modulus for the exponent and multiply by coeff
// Since we discard the top word p.w[3], we could specially optimize this.

  m = bid_decimal128_moduli[e+35];
  __mul_128x384_to_512(p,c,m);

// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.

            

Reported by Cppcheck.

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

Line: 12514 CWE codes: 758

              // Since we discard the top word p.w[3], we could specially optimize this.

  m = bid_decimal128_moduli[e+35];
  __mul_128x384_to_512(p,c,m);

// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.


            

Reported by Cppcheck.

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

Line: 12520 CWE codes: 758

              // modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.

  k = p.w[5] >> 62;
  sll256_short(p.w[5],p.w[4],p.w[3],p.w[2],2);

// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)

            

Reported by Cppcheck.

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

Line: 12521 CWE codes: 758

              // use modulo (pi/2) reduction at the start to keep integer parities.

  k = p.w[5] >> 62;
  sll256_short(p.w[5],p.w[4],p.w[3],p.w[2],2);

// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)
// Set "sf" to the correct sign for the fraction

            

Reported by Cppcheck.

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

Line: 12560 CWE codes: 758

              
// Shift right to be in the right place for a quad coefficient

  srl128_short(p.w[5],p.w[4],15);

// Mask off integer bit and set up as quad precision number

  { union { BID_F128_TYPE d; BID_UINT128 i; } di;
    di.i.w[BID_LOW_128W] = p.w[4];

            

Reported by Cppcheck.

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

Line: 12567 CWE codes: 758

                { union { BID_F128_TYPE d; BID_UINT128 i; } di;
    di.i.w[BID_LOW_128W] = p.w[4];
    di.i.w[BID_HIGH_128W] =
          (((BID_UINT64) sf) << 63) + (((BID_UINT64)(ef)) << 48) +
          (p.w[5] & ((1ull<<48)-1));
    xd = di.d;
  }

// Multiply by pi/2 so we can use regular binary trig functions.

            

Reported by Cppcheck.

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

Line: 12567 CWE codes: 758

                { union { BID_F128_TYPE d; BID_UINT128 i; } di;
    di.i.w[BID_LOW_128W] = p.w[4];
    di.i.w[BID_HIGH_128W] =
          (((BID_UINT64) sf) << 63) + (((BID_UINT64)(ef)) << 48) +
          (p.w[5] & ((1ull<<48)-1));
    xd = di.d;
  }

// Multiply by pi/2 so we can use regular binary trig functions.

            

Reported by Cppcheck.

buildscripts/resmokelib/symbolizer/__init__.py
9 issues
Consider possible security implications associated with subprocess module.
Security blacklist

Line: 5
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import logging
import os
import shutil
import subprocess
import sys

import structlog

from buildscripts import mongosymb

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 123
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                          if "mongodb-mongo-" in module_name:
                with open(os.path.join(self.dest_dir, "patch.diff"), 'w') as git_diff_file:
                    git_diff_file.write(diff)
                    subprocess.run(["git", "apply", "patch.diff"], cwd=self.dest_dir, check=True)

    def _get_source(self):
        revision = self.task_info.revision
        source_url = f"https://github.com/mongodb/mongo/archive/{revision}.zip"
        # TODO: enterprise.

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 123
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

                          if "mongodb-mongo-" in module_name:
                with open(os.path.join(self.dest_dir, "patch.diff"), 'w') as git_diff_file:
                    git_diff_file.write(diff)
                    subprocess.run(["git", "apply", "patch.diff"], cwd=self.dest_dir, check=True)

    def _get_source(self):
        revision = self.task_info.revision
        source_url = f"https://github.com/mongodb/mongo/archive/{revision}.zip"
        # TODO: enterprise.

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 132
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

              
        try:
            cache_dir = mkdtemp_in_build_dir()
            subprocess.run(["curl", "-L", "-o", "source.zip", source_url], cwd=cache_dir,
                           check=True)
            subprocess.run(["unzip", "-q", "source.zip"], cwd=cache_dir, check=True)
            subprocess.run(["rm", "source.zip"], cwd=cache_dir, check=True)

            # Do a little dance to get the downloaded source into `self.dest_dir`

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 132
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

              
        try:
            cache_dir = mkdtemp_in_build_dir()
            subprocess.run(["curl", "-L", "-o", "source.zip", source_url], cwd=cache_dir,
                           check=True)
            subprocess.run(["unzip", "-q", "source.zip"], cwd=cache_dir, check=True)
            subprocess.run(["rm", "source.zip"], cwd=cache_dir, check=True)

            # Do a little dance to get the downloaded source into `self.dest_dir`

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 134
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                          cache_dir = mkdtemp_in_build_dir()
            subprocess.run(["curl", "-L", "-o", "source.zip", source_url], cwd=cache_dir,
                           check=True)
            subprocess.run(["unzip", "-q", "source.zip"], cwd=cache_dir, check=True)
            subprocess.run(["rm", "source.zip"], cwd=cache_dir, check=True)

            # Do a little dance to get the downloaded source into `self.dest_dir`
            src_dir = os.path.join(cache_dir, f"mongo-{revision}")
            if not os.path.isdir(src_dir):

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 134
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

                          cache_dir = mkdtemp_in_build_dir()
            subprocess.run(["curl", "-L", "-o", "source.zip", source_url], cwd=cache_dir,
                           check=True)
            subprocess.run(["unzip", "-q", "source.zip"], cwd=cache_dir, check=True)
            subprocess.run(["rm", "source.zip"], cwd=cache_dir, check=True)

            # Do a little dance to get the downloaded source into `self.dest_dir`
            src_dir = os.path.join(cache_dir, f"mongo-{revision}")
            if not os.path.isdir(src_dir):

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 135
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                          subprocess.run(["curl", "-L", "-o", "source.zip", source_url], cwd=cache_dir,
                           check=True)
            subprocess.run(["unzip", "-q", "source.zip"], cwd=cache_dir, check=True)
            subprocess.run(["rm", "source.zip"], cwd=cache_dir, check=True)

            # Do a little dance to get the downloaded source into `self.dest_dir`
            src_dir = os.path.join(cache_dir, f"mongo-{revision}")
            if not os.path.isdir(src_dir):
                raise FileNotFoundError(

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 135
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

                          subprocess.run(["curl", "-L", "-o", "source.zip", source_url], cwd=cache_dir,
                           check=True)
            subprocess.run(["unzip", "-q", "source.zip"], cwd=cache_dir, check=True)
            subprocess.run(["rm", "source.zip"], cwd=cache_dir, check=True)

            # Do a little dance to get the downloaded source into `self.dest_dir`
            src_dir = os.path.join(cache_dir, f"mongo-{revision}")
            if not os.path.isdir(src_dir):
                raise FileNotFoundError(

            

Reported by Bandit.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_cos.c
9 issues
Shifting 32-bit value by 63 bits is undefined behaviour
Error

Line: 12441 CWE codes: 758

              
// Decompose the input and check for NaN and infinity.

  s = x.w[BID_HIGH_128W] >> 63;
  if ((x.w[BID_HIGH_128W] & (3ull<<61)) == (3ull<<61))
   { if ((x.w[BID_HIGH_128W] & (0xFull<<59)) == (0xFull<<59))
      { if ((x.w[BID_HIGH_128W] & (0x1Full<<58)) != (0x1Full<<58))
         { // input is infinite, so return NaN
           #ifdef BID_SET_STATUS_FLAGS

            

Reported by Cppcheck.

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

Line: 12479 CWE codes: 758

                 }
  else
   { // "small coefficient" input, the normal case for finite numbers
     e = ((x.w[BID_HIGH_128W] >> 49) & ((1ull<<14)-1)) - 6176;
     c.w[1] = x.w[BID_HIGH_128W] & ((1ull<<49)-1);
     c.w[0] = x.w[BID_LOW_128W];
     if (lt128(542101086242752ull,4003012203950112767ull,c.w[1],c.w[0]))
      { c.w[1] = 0ull; c.w[0] = 0ull; }
   }

            

Reported by Cppcheck.

Array 'bid_decimal128_moduli[6147]' accessed at index -18, which is out of bounds.
Error

Line: 12514 CWE codes: 786

              // Pick out the appropriate modulus for the exponent and multiply by coeff
// Since we discard the top word p.w[3], we could specially optimize this.

  m = bid_decimal128_moduli[e+35];
  __mul_128x384_to_512(p,c,m);

// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.

            

Reported by Cppcheck.

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

Line: 12515 CWE codes: 758

              // Since we discard the top word p.w[3], we could specially optimize this.

  m = bid_decimal128_moduli[e+35];
  __mul_128x384_to_512(p,c,m);

// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.


            

Reported by Cppcheck.

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

Line: 12521 CWE codes: 758

              // modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.

  k = p.w[5] >> 62;
  sll256_short(p.w[5],p.w[4],p.w[3],p.w[2],2);

// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)

            

Reported by Cppcheck.

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

Line: 12522 CWE codes: 758

              // use modulo (pi/2) reduction at the start to keep integer parities.

  k = p.w[5] >> 62;
  sll256_short(p.w[5],p.w[4],p.w[3],p.w[2],2);

// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)
// Set "sf" to the correct sign for the fraction

            

Reported by Cppcheck.

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

Line: 12561 CWE codes: 758

              
// Shift right to be in the right place for a quad coefficient

  srl128_short(p.w[5],p.w[4],15);

// Mask off integer bit and set up as quad precision number

  { union { BID_F128_TYPE d; BID_UINT128 i; } di;
    di.i.w[BID_LOW_128W] = p.w[4];

            

Reported by Cppcheck.

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

Line: 12568 CWE codes: 758

                { union { BID_F128_TYPE d; BID_UINT128 i; } di;
    di.i.w[BID_LOW_128W] = p.w[4];
    di.i.w[BID_HIGH_128W] =
          (((BID_UINT64) sf) << 63) + (((BID_UINT64)(ef)) << 48) +
          (p.w[5] & ((1ull<<48)-1));
    xd = di.d;
  }

// Multiply by pi/2 so we can use regular binary trig functions.

            

Reported by Cppcheck.

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

Line: 12568 CWE codes: 758

                { union { BID_F128_TYPE d; BID_UINT128 i; } di;
    di.i.w[BID_LOW_128W] = p.w[4];
    di.i.w[BID_HIGH_128W] =
          (((BID_UINT64) sf) << 63) + (((BID_UINT64)(ef)) << 48) +
          (p.w[5] & ((1ull<<48)-1));
    xd = di.d;
  }

// Multiply by pi/2 so we can use regular binary trig functions.

            

Reported by Cppcheck.

src/third_party/wiredtiger/test/suite/test_hs04.py
9 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              #   Test file_max configuration and reconfiguration for the history store table.
#

import wiredtiger, wttest
from wtscenario import make_scenarios

# Taken from src/include/misc.h.
WT_MB = 1048576


            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 60 Column: 5

                  scenarios = make_scenarios(init_file_max_values, reconfig_file_max_values,
                               in_memory_values)

    def conn_config(self):
        config = 'statistics=(fast)'
        if self.init_file_max is not None:
            config += ',history_store=(file_max={})'.format(self.init_file_max)
        if self.in_memory is not None:
            config += ',in_memory=' + ('true' if self.in_memory else 'false')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 33 Column: 1

              #   Test file_max configuration and reconfiguration for the history store table.
#

import wiredtiger, wttest
from wtscenario import make_scenarios

# Taken from src/include/misc.h.
WT_MB = 1048576


            

Reported by Pylint.

Class name "test_hs04" doesn't conform to PascalCase naming style
Error

Line: 39 Column: 1

              # Taken from src/include/misc.h.
WT_MB = 1048576

class test_hs04(wttest.WiredTigerTestCase):
    uri = 'table:hs_04'
    in_memory_values = [
        ('false', dict(in_memory=False)),
        ('none', dict(in_memory=None)),
        ('true', dict(in_memory=True))

            

Reported by Pylint.

Missing class docstring
Error

Line: 39 Column: 1

              # Taken from src/include/misc.h.
WT_MB = 1048576

class test_hs04(wttest.WiredTigerTestCase):
    uri = 'table:hs_04'
    in_memory_values = [
        ('false', dict(in_memory=False)),
        ('none', dict(in_memory=None)),
        ('true', dict(in_memory=True))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 60 Column: 5

                  scenarios = make_scenarios(init_file_max_values, reconfig_file_max_values,
                               in_memory_values)

    def conn_config(self):
        config = 'statistics=(fast)'
        if self.init_file_max is not None:
            config += ',history_store=(file_max={})'.format(self.init_file_max)
        if self.in_memory is not None:
            config += ',in_memory=' + ('true' if self.in_memory else 'false')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 68 Column: 5

                          config += ',in_memory=' + ('true' if self.in_memory else 'false')
        return config

    def get_stat(self, stat):
        stat_cursor = self.session.open_cursor('statistics:')
        val = stat_cursor[stat][2]
        stat_cursor.close()
        return val


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 74 Column: 5

                      stat_cursor.close()
        return val

    def test_hs(self):
        self.session.create(self.uri, 'key_format=S,value_format=S')

        if self.in_memory:
            # For in-memory configurations, we simply ignore any history store
            # related configuration.

            

Reported by Pylint.

site_scons/site_tools/separate_debug.py
9 issues
Unable to import 'SCons'
Error

Line: 23 Column: 1

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

import SCons


def _update_builder(env, builder):

    old_scanner = builder.target_scanner

            

Reported by Pylint.

TODO: Make variables for dsymutil and strip, and for the action
Error

Line: 52 Column: 3

                  if not isinstance(base_action, SCons.Action.ListAction):
        base_action = SCons.Action.ListAction([base_action])

    # TODO: Make variables for dsymutil and strip, and for the action
    # strings. We should really be running these tools as found by
    # xcrun by default. We should achieve that by upgrading the
    # site_scons/site_tools/xcode.py tool to search for these for
    # us. We could then also remove a lot of the compiler and sysroot
    # setup from the etc/scons/xcode_*.vars files, which would be a

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright 2020 MongoDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:

            

Reported by Pylint.

Line too long (107/100)
Error

Line: 112 Column: 1

              
            plist_file = env.File("Contents/Info.plist", directory=dsym_dir)
            setattr(plist_file.attributes, "aib_effective_suffix", ".dSYM")
            setattr(plist_file.attributes, "aib_additional_directory", "{}/Contents".format(dsym_dir_name))

            dwarf_dir = env.Dir("Contents/Resources/DWARF", directory=dsym_dir)

            dwarf_file = env.File(target0.name, directory=dwarf_dir)
            setattr(dwarf_file.attributes, "aib_effective_suffix", ".dSYM")

            

Reported by Pylint.

Line too long (123/100)
Error

Line: 118 Column: 1

              
            dwarf_file = env.File(target0.name, directory=dwarf_dir)
            setattr(dwarf_file.attributes, "aib_effective_suffix", ".dSYM")
            setattr(dwarf_file.attributes, "aib_additional_directory", "{}/Contents/Resources/DWARF".format(dsym_dir_name))

            debug_files.extend([plist_file, dwarf_file])

        elif env.TargetOSIs("posix"):
            debug_file = env.File(str(target[0]) + ".debug")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 153 Column: 1

                  builder.emitter = new_emitter


def generate(env):
    if not exists(env):
        return

    if env.TargetOSIs("darwin"):


            

Reported by Pylint.

Line too long (103/100)
Error

Line: 177 Column: 1

              
        if not env.Verbose():
            env.Append(
                OBJCOPY_ONLY_KEEP_DEBUG_COMSTR="Generating debug info for $TARGET into ${TARGET}.dSYM",
                DEBUGSTRIPCOMSTR="Stripping debug info from ${TARGET} and adding .gnu.debuglink to ${TARGET}.debug",
            )

    for builder in ["Program", "SharedLibrary", "LoadableModule"]:
        _update_builder(env, env["BUILDERS"][builder])

            

Reported by Pylint.

Line too long (116/100)
Error

Line: 178 Column: 1

                      if not env.Verbose():
            env.Append(
                OBJCOPY_ONLY_KEEP_DEBUG_COMSTR="Generating debug info for $TARGET into ${TARGET}.dSYM",
                DEBUGSTRIPCOMSTR="Stripping debug info from ${TARGET} and adding .gnu.debuglink to ${TARGET}.debug",
            )

    for builder in ["Program", "SharedLibrary", "LoadableModule"]:
        _update_builder(env, env["BUILDERS"][builder])


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 185 Column: 1

                      _update_builder(env, env["BUILDERS"][builder])


def exists(env):
    if env.TargetOSIs("darwin"):
        if env.get("DSYMUTIL", None) is None and env.WhereIs("dsymutil") is None:
            return False
        if env.get("STRIP", None) is None and env.WhereIs("strip") is None:
            return False

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/builtin/TestingFunctions.cpp
9 issues
getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 85 Column: 25 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

              static bool
EnvVarIsDefined(const char* name)
{
    const char* value = getenv(name);
    return value && *value;
}

#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
static bool

            

Reported by FlawFinder.

getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 96 Column: 22 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                  if (!EnvVarIsDefined(name))
        return false;

    *valueOut = atoi(getenv(name));
    return true;
}
#endif

static bool

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 96 Column: 17 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                  if (!EnvVarIsDefined(name))
        return false;

    *valueOut = atoi(getenv(name));
    return true;
}
#endif

static bool

            

Reported by FlawFinder.

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

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

                  JSGCInvocationKind gckind = shrinking ? GC_SHRINK : GC_NORMAL;
    JS::GCForReason(cx, gckind, JS::gcreason::API);

    char buf[256] = { '\0' };
#ifndef JS_MORE_DETERMINISTIC
    SprintfLiteral(buf, "before %zu, after %zu\n",
                   preBytes, cx->runtime()->gc.usage.gcBytes());
#endif
    return ReturnStringCopy(cx, args, buf);

            

Reported by FlawFinder.

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

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

                  if (!obj)
        return false;

    memcpy(obj->as<TypedArrayObject>().viewDataUnshared(), bytes.begin(), bytes.length());

    args.rval().setObject(*obj);
    return true;
}


            

Reported by FlawFinder.

fopen - 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: 2235 Column: 28 CWE codes: 362

                              if (!fileNameBytes.encodeLatin1(cx, str))
                    return false;
                const char* fileName = fileNameBytes.ptr();
                dumpFile = fopen(fileName, "w");
                if (!dumpFile) {
                    fileNameBytes.clear();
                    if (!fileNameBytes.encodeUtf8(cx, str))
                        return false;
                    JS_ReportErrorUTF8(cx, "can't open %s", fileNameBytes.ptr());

            

Reported by FlawFinder.

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

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

                  return true;
#else
    void* ptr = js::UncheckedUnwrap(&args[0].toObject(), true);
    char buffer[64];
    SprintfLiteral(buffer, "%p", ptr);

    return ReturnStringCopy(cx, args, buffer);
#endif
}

            

Reported by FlawFinder.

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

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

                      JS_ReportErrorASCII(cx, "Argument must be a SharedArrayBuffer");
        return false;
    }
    char buffer[64];
    uint32_t nchar =
        SprintfLiteral(buffer, "%p",
                       obj->as<SharedArrayBufferObject>().dataPointerShared().unwrap(/*safeish*/));

    JSString* str = JS_NewStringCopyN(cx, buffer, nchar);

            

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: 2375 Column: 29 CWE codes: 126

                          if (!JS_DefineProperty(cx, inlineFrameInfo, "kind", frameKind, propAttrs))
                return false;

            size_t length = strlen(inlineFrame.label.get());
            auto label = reinterpret_cast<Latin1Char*>(inlineFrame.label.release());
            frameLabel = NewString<CanGC>(cx, label, length);
            if (!frameLabel)
                return false;


            

Reported by FlawFinder.

src/third_party/mozjs-60/extract/js/src/builtin/SIMD.h
9 issues
equal - Function does not check the second iterator for over-read conditions
Security

Line: 133 Column: 5 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

              #define FLOAT32X4_BINARY_FUNCTION_LIST(V)                                             \
  V(add, (BinaryFunc<Float32x4, Add, Float32x4>), 2)                                  \
  V(div, (BinaryFunc<Float32x4, Div, Float32x4>), 2)                                  \
  V(equal, (CompareFunc<Float32x4, Equal, Bool32x4>), 2)                              \
  V(extractLane, (ExtractLane<Float32x4>), 2)                                         \
  V(greaterThan, (CompareFunc<Float32x4, GreaterThan, Bool32x4>), 2)                  \
  V(greaterThanOrEqual, (CompareFunc<Float32x4, GreaterThanOrEqual, Bool32x4>), 2)    \
  V(lessThan, (CompareFunc<Float32x4, LessThan, Bool32x4>), 2)                        \
  V(lessThanOrEqual, (CompareFunc<Float32x4, LessThanOrEqual, Bool32x4>), 2)          \

            

Reported by FlawFinder.

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

Line: 189 Column: 5 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

              #define FLOAT64X2_BINARY_FUNCTION_LIST(V)                                             \
  V(add, (BinaryFunc<Float64x2, Add, Float64x2>), 2)                                  \
  V(div, (BinaryFunc<Float64x2, Div, Float64x2>), 2)                                  \
  V(equal, (CompareFunc<Float64x2, Equal, Bool64x2>), 2)                              \
  V(extractLane, (ExtractLane<Float64x2>), 2)                                         \
  V(greaterThan, (CompareFunc<Float64x2, GreaterThan, Bool64x2>), 2)                  \
  V(greaterThanOrEqual, (CompareFunc<Float64x2, GreaterThanOrEqual, Bool64x2>), 2)    \
  V(lessThan, (CompareFunc<Float64x2, LessThan, Bool64x2>), 2)                        \
  V(lessThanOrEqual, (CompareFunc<Float64x2, LessThanOrEqual, Bool64x2>), 2)          \

            

Reported by FlawFinder.

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

Line: 239 Column: 5 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

                V(add, (BinaryFunc<Int8x16, Add, Int8x16>), 2)                                      \
  V(addSaturate, (BinaryFunc<Int8x16, AddSaturate, Int8x16>), 2)                      \
  V(and, (BinaryFunc<Int8x16, And, Int8x16>), 2)                                      \
  V(equal, (CompareFunc<Int8x16, Equal, Bool8x16>), 2)                                \
  V(extractLane, (ExtractLane<Int8x16>), 2)                                           \
  V(greaterThan, (CompareFunc<Int8x16, GreaterThan, Bool8x16>), 2)                    \
  V(greaterThanOrEqual, (CompareFunc<Int8x16, GreaterThanOrEqual, Bool8x16>), 2)      \
  V(lessThan, (CompareFunc<Int8x16, LessThan, Bool8x16>), 2)                          \
  V(lessThanOrEqual, (CompareFunc<Int8x16, LessThanOrEqual, Bool8x16>), 2)            \

            

Reported by FlawFinder.

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

Line: 288 Column: 5 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

                V(add, (BinaryFunc<Uint8x16, Add, Uint8x16>), 2)                                    \
  V(addSaturate, (BinaryFunc<Uint8x16, AddSaturate, Uint8x16>), 2)                    \
  V(and, (BinaryFunc<Uint8x16, And, Uint8x16>), 2)                                    \
  V(equal, (CompareFunc<Uint8x16, Equal, Bool8x16>), 2)                               \
  V(extractLane, (ExtractLane<Uint8x16>), 2)                                          \
  V(greaterThan, (CompareFunc<Uint8x16, GreaterThan, Bool8x16>), 2)                   \
  V(greaterThanOrEqual, (CompareFunc<Uint8x16, GreaterThanOrEqual, Bool8x16>), 2)     \
  V(lessThan, (CompareFunc<Uint8x16, LessThan, Bool8x16>), 2)                         \
  V(lessThanOrEqual, (CompareFunc<Uint8x16, LessThanOrEqual, Bool8x16>), 2)           \

            

Reported by FlawFinder.

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

Line: 337 Column: 5 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

                V(add, (BinaryFunc<Int16x8, Add, Int16x8>), 2)                                      \
  V(addSaturate, (BinaryFunc<Int16x8, AddSaturate, Int16x8>), 2)                      \
  V(and, (BinaryFunc<Int16x8, And, Int16x8>), 2)                                      \
  V(equal, (CompareFunc<Int16x8, Equal, Bool16x8>), 2)                                \
  V(extractLane, (ExtractLane<Int16x8>), 2)                                           \
  V(greaterThan, (CompareFunc<Int16x8, GreaterThan, Bool16x8>), 2)                    \
  V(greaterThanOrEqual, (CompareFunc<Int16x8, GreaterThanOrEqual, Bool16x8>), 2)      \
  V(lessThan, (CompareFunc<Int16x8, LessThan, Bool16x8>), 2)                          \
  V(lessThanOrEqual, (CompareFunc<Int16x8, LessThanOrEqual, Bool16x8>), 2)            \

            

Reported by FlawFinder.

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

Line: 386 Column: 5 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

                V(add, (BinaryFunc<Uint16x8, Add, Uint16x8>), 2)                                    \
  V(addSaturate, (BinaryFunc<Uint16x8, AddSaturate, Uint16x8>), 2)                    \
  V(and, (BinaryFunc<Uint16x8, And, Uint16x8>), 2)                                    \
  V(equal, (CompareFunc<Uint16x8, Equal, Bool16x8>), 2)                               \
  V(extractLane, (ExtractLane<Uint16x8>), 2)                                          \
  V(greaterThan, (CompareFunc<Uint16x8, GreaterThan, Bool16x8>), 2)                   \
  V(greaterThanOrEqual, (CompareFunc<Uint16x8, GreaterThanOrEqual, Bool16x8>), 2)     \
  V(lessThan, (CompareFunc<Uint16x8, LessThan, Bool16x8>), 2)                         \
  V(lessThanOrEqual, (CompareFunc<Uint16x8, LessThanOrEqual, Bool16x8>), 2)           \

            

Reported by FlawFinder.

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

Line: 435 Column: 5 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

              #define INT32X4_BINARY_FUNCTION_LIST(V)                                               \
  V(add, (BinaryFunc<Int32x4, Add, Int32x4>), 2)                                      \
  V(and, (BinaryFunc<Int32x4, And, Int32x4>), 2)                                      \
  V(equal, (CompareFunc<Int32x4, Equal, Bool32x4>), 2)                                \
  V(extractLane, (ExtractLane<Int32x4>), 2)                                           \
  V(greaterThan, (CompareFunc<Int32x4, GreaterThan, Bool32x4>), 2)                    \
  V(greaterThanOrEqual, (CompareFunc<Int32x4, GreaterThanOrEqual, Bool32x4>), 2)      \
  V(lessThan, (CompareFunc<Int32x4, LessThan, Bool32x4>), 2)                          \
  V(lessThanOrEqual, (CompareFunc<Int32x4, LessThanOrEqual, Bool32x4>), 2)            \

            

Reported by FlawFinder.

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

Line: 489 Column: 5 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

              #define UINT32X4_BINARY_FUNCTION_LIST(V)                                              \
  V(add, (BinaryFunc<Uint32x4, Add, Uint32x4>), 2)                                    \
  V(and, (BinaryFunc<Uint32x4, And, Uint32x4>), 2)                                    \
  V(equal, (CompareFunc<Uint32x4, Equal, Bool32x4>), 2)                               \
  V(extractLane, (ExtractLane<Uint32x4>), 2)                                          \
  V(greaterThan, (CompareFunc<Uint32x4, GreaterThan, Bool32x4>), 2)                   \
  V(greaterThanOrEqual, (CompareFunc<Uint32x4, GreaterThanOrEqual, Bool32x4>), 2)     \
  V(lessThan, (CompareFunc<Uint32x4, LessThan, Bool32x4>), 2)                         \
  V(lessThanOrEqual, (CompareFunc<Uint32x4, LessThanOrEqual, Bool32x4>), 2)           \

            

Reported by FlawFinder.

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

Line: 613 Column: 7 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

              #define FOREACH_COMP_SIMD_OP(_)       \
    _(lessThan)                       \
    _(lessThanOrEqual)                \
    _(equal)                          \
    _(notEqual)                       \
    _(greaterThan)                    \
    _(greaterThanOrEqual)

/*

            

Reported by FlawFinder.

buildscripts/resmokelib/powercycle/powercycle.py
9 issues
Possible binding to all interfaces.
Security

Line: 623
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b104_hardcoded_bind_all_interfaces.html

                      self.set_mongod_option("logappend")
        self.port = port
        self.set_mongod_option("port", port)
        self.set_mongod_option("bind_ip", "0.0.0.0")
        if _IS_WINDOWS:
            self.set_mongod_option("service")
            self._service = WindowsService
        else:
            self.set_mongod_option("fork")

            

Reported by Bandit.

Try, Except, Pass detected.
Security

Line: 117
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html

                          with open(REPORT_JSON_FILE, "w") as jstream:
                json.dump(REPORT_JSON, jstream)
            LOGGER.debug("Exit handler: report file contents %s", REPORT_JSON)
        except:  # pylint: disable=bare-except
            pass

    if EXIT_YML_FILE:
        LOGGER.debug("Exit handler: Saving exit file %s", EXIT_YML_FILE)
        try:

            

Reported by Bandit.

Try, Except, Pass detected.
Security

Line: 126
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html

                          with open(EXIT_YML_FILE, "w") as yaml_stream:
                yaml.safe_dump(EXIT_YML, yaml_stream)
            LOGGER.debug("Exit handler: report file contents %s", EXIT_YML)
        except:  # pylint: disable=bare-except
            pass

    LOGGER.debug("Exit handler: Killing processes")
    try:
        Processes.kill_all()

            

Reported by Bandit.

Try, Except, Pass detected.
Security

Line: 133
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html

                  try:
        Processes.kill_all()
        LOGGER.debug("Exit handler: Killing processes finished")
    except:  # pylint: disable=bare-except
        pass

    LOGGER.debug("Exit handler: Cleaning up temporary files")
    try:
        NamedTempFile.delete_all()

            

Reported by Bandit.

Try, Except, Pass detected.
Security

Line: 140
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html

                  try:
        NamedTempFile.delete_all()
        LOGGER.debug("Exit handler: Cleaning up temporary files finished")
    except:  # pylint: disable=bare-except
        pass


def register_signal_handler(handler):
    """Register the signal handler."""

            

Reported by Bandit.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 1062
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                      task_config, crash_canary, local_ops, script_name, client_args):
    """Crash server or kill mongod and optionally write canary doc. Return tuple (ret, output)."""

    crash_wait_time = powercycle_constants.CRASH_WAIT_TIME + random.randint(
        0, powercycle_constants.CRASH_WAIT_TIME_JITTER)
    message_prefix = "Killing mongod" if task_config.crash_method == "kill" else "Crashing server"
    LOGGER.info("%s in %d seconds", message_prefix, crash_wait_time)
    time.sleep(crash_wait_time)


            

Reported by Bandit.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 1221
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                  def rand_string(max_length=1024):
        """Return random string of random length."""
        return ''.join(
            random.choice(string.ascii_letters) for _ in range(random.randint(1, max_length)))

    LOGGER.info("Seeding DB '%s' collection '%s' with %d documents, %d already exist", db_name,
                coll_name, num_docs, mongo[db_name][coll_name].count())
    random.seed()
    base_num = 100000

            

Reported by Bandit.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 1221
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                  def rand_string(max_length=1024):
        """Return random string of random length."""
        return ''.join(
            random.choice(string.ascii_letters) for _ in range(random.randint(1, max_length)))

    LOGGER.info("Seeding DB '%s' collection '%s' with %d documents, %d already exist", db_name,
                coll_name, num_docs, mongo[db_name][coll_name].count())
    random.seed()
    base_num = 100000

            

Reported by Bandit.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 1234
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                      if num_coll_docs >= num_docs:
            break
        mongo[db_name][coll_name].insert_many(
            [{"x": random.randint(0, base_num), "doc": rand_string(1024)} for _ in range(bulk_num)])
    LOGGER.info("After seeding there are %d documents in the collection",
                mongo[db_name][coll_name].count())
    return 0



            

Reported by Bandit.

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

Line: 103 Column: 18 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

              inline int leadingOnes(unsigned char c) {
    if (c < 0x80)
        return 0;
    static const char _leadingOnes[128] = {
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  // 0x80 - 0x8F
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  // 0x90 - 0x99
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  // 0xA0 - 0xA9
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  // 0xB0 - 0xB9
        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,  // 0xC0 - 0xC9

            

Reported by FlawFinder.

MultiByteToWideChar - Requires maximum length in CHARACTERS, not bytes
Security

Line: 181 Column: 22 CWE codes: 120

              }

std::wstring toWideStringFromStringData(StringData utf8String) {
    int bufferSize = MultiByteToWideChar(CP_UTF8,               // Code page
                                         0,                     // Flags
                                         utf8String.rawData(),  // Input string
                                         utf8String.size(),     // Count, -1 for NUL-terminated
                                         nullptr,               // No output buffer
                                         0  // Zero means "compute required size"

            

Reported by FlawFinder.

MultiByteToWideChar - Requires maximum length in CHARACTERS, not bytes
Security

Line: 193 Column: 5 CWE codes: 120

                  }
    std::unique_ptr<wchar_t[]> tempBuffer(new wchar_t[bufferSize]);
    tempBuffer[0] = L'0';
    MultiByteToWideChar(CP_UTF8,               // Code page
                        0,                     // Flags
                        utf8String.rawData(),  // Input string
                        utf8String.size(),     // Count, -1 for NUL-terminated
                        tempBuffer.get(),      // UTF-16 output buffer
                        bufferSize             // Buffer size in wide characters

            

Reported by FlawFinder.

MultiByteToWideChar - Requires maximum length in CHARACTERS, not bytes
Security

Line: 204 Column: 22 CWE codes: 120

              }

std::wstring toWideString(const char* utf8String) {
    int bufferSize = MultiByteToWideChar(CP_UTF8,     // Code page
                                         0,           // Flags
                                         utf8String,  // Input string
                                         -1,          // Count, -1 for NUL-terminated
                                         nullptr,     // No output buffer
                                         0            // Zero means "compute required size"

            

Reported by FlawFinder.

MultiByteToWideChar - Requires maximum length in CHARACTERS, not bytes
Security

Line: 216 Column: 5 CWE codes: 120

                  }
    std::unique_ptr<wchar_t[]> tempBuffer(new wchar_t[bufferSize]);
    tempBuffer[0] = 0;
    MultiByteToWideChar(CP_UTF8,           // Code page
                        0,                 // Flags
                        utf8String,        // Input string
                        -1,                // Count, -1 for NUL-terminated
                        tempBuffer.get(),  // UTF-16 output buffer
                        bufferSize         // Buffer size in wide characters

            

Reported by FlawFinder.

MultiByteToWideChar - Requires maximum length in CHARACTERS, not bytes
Security

Line: 234 Column: 22 CWE codes: 120

               * @return                  true if all characters were displayed (including zero characters)
 */
bool writeUtf8ToWindowsConsole(const char* utf8String, unsigned int utf8StringSize) {
    int bufferSize = MultiByteToWideChar(CP_UTF8,         // Code page
                                         0,               // Flags
                                         utf8String,      // Input string
                                         utf8StringSize,  // Input string length
                                         nullptr,         // No output buffer
                                         0                // Zero means "compute required size"

            

Reported by FlawFinder.

MultiByteToWideChar - Requires maximum length in CHARACTERS, not bytes
Security

Line: 245 Column: 5 CWE codes: 120

                      return true;
    }
    std::unique_ptr<wchar_t[]> utf16String(new wchar_t[bufferSize]);
    MultiByteToWideChar(CP_UTF8,            // Code page
                        0,                  // Flags
                        utf8String,         // Input string
                        utf8StringSize,     // Input string length
                        utf16String.get(),  // UTF-16 output buffer
                        bufferSize          // Buffer size in wide characters

            

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: 57 Column: 22 CWE codes: 126

                  const char* foo = strstr(_big, _splitter);
    if (foo) {
        std::string s(_big, foo - _big);
        _big = foo + strlen(_splitter);
        while (*_big && strstr(_big, _splitter) == _big)
            _big++;
        return s;
    }


            

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: 64 Column: 13 CWE codes: 126

                  }

    std::string s = _big;
    _big += strlen(_big);
    return s;
}


void StringSplitter::split(std::vector<std::string>& l) {

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_bug005.py
9 issues
Unable to import 'wiredtiger'
Error

Line: 36 Column: 1

              # test_bug005.py
#       Regression tests.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, simple_key, simple_value

# Check that verify works when the file has additional data after the last
# checkpoint.
class test_bug005(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 36 Column: 1

              # test_bug005.py
#       Regression tests.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, simple_key, simple_value

# Check that verify works when the file has additional data after the last
# checkpoint.
class test_bug005(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused SimpleDataSet imported from wtdataset
Error

Line: 37 Column: 1

              #       Regression tests.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, simple_key, simple_value

# Check that verify works when the file has additional data after the last
# checkpoint.
class test_bug005(wttest.WiredTigerTestCase):
    # This is a btree layer test, test files, ignore tables.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 36 Column: 1

              # test_bug005.py
#       Regression tests.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, simple_key, simple_value

# Check that verify works when the file has additional data after the last
# checkpoint.
class test_bug005(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 41 Column: 1

              
# Check that verify works when the file has additional data after the last
# checkpoint.
class test_bug005(wttest.WiredTigerTestCase):
    # This is a btree layer test, test files, ignore tables.
    uri = 'file:test_bug005'

    def test_bug005(self):
        # Create the object.

            

Reported by Pylint.

Class name "test_bug005" doesn't conform to PascalCase naming style
Error

Line: 41 Column: 1

              
# Check that verify works when the file has additional data after the last
# checkpoint.
class test_bug005(wttest.WiredTigerTestCase):
    # This is a btree layer test, test files, ignore tables.
    uri = 'file:test_bug005'

    def test_bug005(self):
        # Create the object.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 45 Column: 5

                  # This is a btree layer test, test files, ignore tables.
    uri = 'file:test_bug005'

    def test_bug005(self):
        # Create the object.
        self.session.create(self.uri, 'value_format=S,key_format=S')
        cursor = self.session.open_cursor(self.uri, None)
        for i in range(1, 1000):
            cursor[simple_key(cursor, i)] = simple_value(cursor, i)

            

Reported by Pylint.

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

Line: 59 Column: 9

                      self.session.verify(self.uri)

        # Append random data to the end.
        f = open('test_bug005', 'a')
        f.write('random data')
        f.close()

        # Verify the object again.
        self.session.verify(self.uri)

            

Reported by Pylint.