The following issues were found

src/third_party/unwind/dist/src/ptrace/_UPT_access_reg.c
11 issues
Uninitialized variable: nat_bits
Error

Line: 114 CWE codes: 908

                    if (write)
        {
          if (*val)
            nat_bits |= mask;
          else
            nat_bits &= ~mask;
#ifdef HAVE_TTRACE
#       warning No support for ttrace() yet.
#else

            

Reported by Cppcheck.

Uninitialized variable: nat_bits
Error

Line: 116 CWE codes: 908

                        if (*val)
            nat_bits |= mask;
          else
            nat_bits &= ~mask;
#ifdef HAVE_TTRACE
#       warning No support for ttrace() yet.
#else
          errno = 0;
          ptrace (PTRACE_POKEUSER, pid, PT_NAT_BITS, nat_bits);

            

Reported by Cppcheck.

Uninitialized variable: psr
Error

Line: 153 CWE codes: 908

                        if (write)
            {
              ip = *val & ~0xfUL;
              psr = (psr & ~0x3UL << 41) | (*val & 0x3);
#ifdef HAVE_TTRACE
#       warning No support for ttrace() yet.
#else
              errno = 0;
              ptrace (PTRACE_POKEUSER, pid, PT_CR_IIP, ip);

            

Reported by Cppcheck.

Uninitialized variable: ip
Error

Line: 174 CWE codes: 908

                            if (errno)
                goto badreg;
#endif
              *val = ip + ((psr >> 41) & 0x3);
            }
          goto out;
        }

      case UNW_IA64_AR_BSPSTORE:

            

Reported by Cppcheck.

Uninitialized variable: psr
Error

Line: 174 CWE codes: 908

                            if (errno)
                goto badreg;
#endif
              *val = ip + ((psr >> 41) & 0x3);
            }
          goto out;
        }

      case UNW_IA64_AR_BSPSTORE:

            

Reported by Cppcheck.

Uninitialized variable: cfm
Error

Line: 198 CWE codes: 908

                        if (errno)
            goto badreg;
#endif
          sof = (cfm & 0x7f);

          if (write)
            {
              bsp = rse_skip_regs (*val, sof);
#ifdef HAVE_TTRACE

            

Reported by Cppcheck.

Uninitialized variable: cfm
Error

Line: 243 CWE codes: 908

              #endif
            if (errno)
              goto badreg;
            old_sof = (cfm & 0x7f);
            new_sof = (*val & 0x7f);
            if (old_sof != new_sof)
              {
                bsp = rse_skip_regs (bsp, -old_sof + new_sof);
#ifdef HAVE_TTRACE

            

Reported by Cppcheck.

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

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

                if (ptrace (PTRACE_GETREGSET, pid, NT_PRSTATUS, &loc) == -1)
    goto badreg;
  if (write) {
    memcpy(r, val, sizeof(unw_word_t));
    if (ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &loc) == -1)
      goto badreg;
  } else
    memcpy(val, r, sizeof(unw_word_t));
  return 0;

            

Reported by FlawFinder.

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

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

                  if (ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &loc) == -1)
      goto badreg;
  } else
    memcpy(val, r, sizeof(unw_word_t));
  return 0;

badreg:
  Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno));
  return -UNW_EBADREG;

            

Reported by FlawFinder.

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

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

                if (ptrace(PT_GETREGS, pid, (caddr_t)&regs, 0) == -1)
    goto badreg;
  if (write) {
      memcpy(r, val, sizeof(unw_word_t));
      if (ptrace(PT_SETREGS, pid, (caddr_t)&regs, 0) == -1)
        goto badreg;
  } else
      memcpy(val, r, sizeof(unw_word_t));
  return 0;

            

Reported by FlawFinder.

site_scons/site_tools/thin_archive.py
11 issues
Unable to import 'SCons'
Error

Line: 23 Column: 1

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

import SCons

import re
import subprocess



            

Reported by Pylint.

Access to a protected member _subproc of a client class
Error

Line: 42 Column: 12

                  if not "rc" in env["ARFLAGS"]:
        return False

    pipe = SCons.Action._subproc(
        env,
        SCons.Util.CLVar(ar) + ["--version"],
        stdin="devnull",
        stderr="devnull",
        stdout=subprocess.PIPE,

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 64 Column: 37

              def _add_emitter(builder):
    base_emitter = builder.emitter

    def new_emitter(target, source, env):
        for t in target:
            setattr(t.attributes, "thin_archive", True)
        return (target, source)

    new_emitter = SCons.Builder.ListEmitter([base_emitter, new_emitter])

            

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.

standard import "import re" should be placed before "import SCons"
Error

Line: 25 Column: 1

              
import SCons

import re
import subprocess


def exists(env):
    if not "AR" in env:

            

Reported by Pylint.

standard import "import subprocess" should be placed before "import SCons"
Error

Line: 26 Column: 1

              import SCons

import re
import subprocess


def exists(env):
    if not "AR" in env:
        return False

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import SCons

import re
import subprocess


def exists(env):
    if not "AR" in env:
        return False

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 29 Column: 1

              import subprocess


def exists(env):
    if not "AR" in env:
        return False

    ar = env.subst(env["AR"])
    if not ar:

            

Reported by Pylint.

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

Line: 33 Column: 5

                  if not "AR" in env:
        return False

    ar = env.subst(env["AR"])
    if not ar:
        return False

    # If the user has done anything confusing with ARFLAGS, bail out. We want to find
    # an item in ARFLAGS of the exact form 'rc'.

            

Reported by Pylint.

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

Line: 65 Column: 13

                  base_emitter = builder.emitter

    def new_emitter(target, source, env):
        for t in target:
            setattr(t.attributes, "thin_archive", True)
        return (target, source)

    new_emitter = SCons.Builder.ListEmitter([base_emitter, new_emitter])
    builder.emitter = new_emitter

            

Reported by Pylint.

src/third_party/unwind/dist/src/ia64/Grbs.c
11 issues
sprintf - Does not check for buffer overflows
Security

Line: 62 Column: 5 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

                  strcat (buf, "fp(");

  if (IA64_IS_REG_LOC (loc))
    sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));
  else
    sprintf (buf + strlen (buf), "0x%llx",
             (unsigned long long) IA64_GET_ADDR (loc));

  if (IA64_IS_FP_LOC (loc))

            

Reported by FlawFinder.

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

Line: 47 Column: 10 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

              HIDDEN const char *
ia64_strloc (ia64_loc_t loc)
{
  static char buf[128];

  if (IA64_IS_NULL_LOC (loc))
    return "<null>";

  buf[0] = '\0';

            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 55 Column: 5 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                buf[0] = '\0';

  if (IA64_IS_MEMSTK_NAT (loc))
    strcat (buf, "memstk_nat(");
  if (IA64_IS_UC_LOC (loc))
    strcat (buf, "uc(");
  if (IA64_IS_FP_LOC (loc))
    strcat (buf, "fp(");


            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 57 Column: 5 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                if (IA64_IS_MEMSTK_NAT (loc))
    strcat (buf, "memstk_nat(");
  if (IA64_IS_UC_LOC (loc))
    strcat (buf, "uc(");
  if (IA64_IS_FP_LOC (loc))
    strcat (buf, "fp(");

  if (IA64_IS_REG_LOC (loc))
    sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));

            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 59 Column: 5 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                if (IA64_IS_UC_LOC (loc))
    strcat (buf, "uc(");
  if (IA64_IS_FP_LOC (loc))
    strcat (buf, "fp(");

  if (IA64_IS_REG_LOC (loc))
    sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));
  else
    sprintf (buf + strlen (buf), "0x%llx",

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 64 Column: 5 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

                if (IA64_IS_REG_LOC (loc))
    sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));
  else
    sprintf (buf + strlen (buf), "0x%llx",
             (unsigned long long) IA64_GET_ADDR (loc));

  if (IA64_IS_FP_LOC (loc))
    strcat (buf, ")");
  if (IA64_IS_UC_LOC (loc))

            

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: 62 Column: 20 CWE codes: 126

                  strcat (buf, "fp(");

  if (IA64_IS_REG_LOC (loc))
    sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));
  else
    sprintf (buf + strlen (buf), "0x%llx",
             (unsigned long long) IA64_GET_ADDR (loc));

  if (IA64_IS_FP_LOC (loc))

            

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: 20 CWE codes: 126

                if (IA64_IS_REG_LOC (loc))
    sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));
  else
    sprintf (buf + strlen (buf), "0x%llx",
             (unsigned long long) IA64_GET_ADDR (loc));

  if (IA64_IS_FP_LOC (loc))
    strcat (buf, ")");
  if (IA64_IS_UC_LOC (loc))

            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 68 Column: 5 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                           (unsigned long long) IA64_GET_ADDR (loc));

  if (IA64_IS_FP_LOC (loc))
    strcat (buf, ")");
  if (IA64_IS_UC_LOC (loc))
    strcat (buf, ")");
  if (IA64_IS_MEMSTK_NAT (loc))
    strcat (buf, ")");


            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 70 Column: 5 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                if (IA64_IS_FP_LOC (loc))
    strcat (buf, ")");
  if (IA64_IS_UC_LOC (loc))
    strcat (buf, ")");
  if (IA64_IS_MEMSTK_NAT (loc))
    strcat (buf, ")");

  return buf;
}

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_txn16.py
11 issues
Unused import time
Error

Line: 34 Column: 1

              #   continue to generate more log files.
#

import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wttest

class test_txn16(wttest.WiredTigerTestCase, suite_subprocess):
    t1 = 'table:test_txn16_1'

            

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 (fnmatch, os, shutil, time)
Error

Line: 34 Column: 1

              #   continue to generate more log files.
#

import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wttest

class test_txn16(wttest.WiredTigerTestCase, suite_subprocess):
    t1 = 'table:test_txn16_1'

            

Reported by Pylint.

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

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wttest

class test_txn16(wttest.WiredTigerTestCase, suite_subprocess):
    t1 = 'table:test_txn16_1'
    t2 = 'table:test_txn16_2'
    t3 = 'table:test_txn16_3'
    nentries = 1000
    create_params = 'key_format=i,value_format=i'

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wttest

class test_txn16(wttest.WiredTigerTestCase, suite_subprocess):
    t1 = 'table:test_txn16_1'
    t2 = 'table:test_txn16_2'
    t3 = 'table:test_txn16_3'
    nentries = 1000
    create_params = 'key_format=i,value_format=i'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 54 Column: 5

                      'transaction_sync=(method=dsync,enabled)'
    conn_off = 'config_base=false,log=(enabled=false)'

    def populate_table(self, uri):
        self.session.create(uri, self.create_params)
        c = self.session.open_cursor(uri, None, None)
        # Populate with an occasional checkpoint to generate
        # some varying LSNs.
        for i in range(self.nentries):

            

Reported by Pylint.

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

Line: 56 Column: 9

              
    def populate_table(self, uri):
        self.session.create(uri, self.create_params)
        c = self.session.open_cursor(uri, None, None)
        # Populate with an occasional checkpoint to generate
        # some varying LSNs.
        for i in range(self.nentries):
            c[i] = i + 1
            if i % 900 == 0:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 81 Column: 5

                      # close the original connection.
        self.close_conn()

    def run_toggle(self, homedir):
        loop = 0
        # Record original log files.  There should never be overlap
        # with these even after they're removed.
        orig_logs = fnmatch.filter(os.listdir(homedir), "*gerLog*")
        while loop < 3:

            

Reported by Pylint.

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

Line: 102 Column: 25

                              self.assertEqual(scur.isdisjoint(sorig), True)
                if loop > 1:
                    # We should be creating the same log files each time.
                    for l in cur_logs:
                        self.assertEqual(l in last_logs, True)
                    for l in last_logs:
                        self.assertEqual(l in cur_logs, True)
                last_logs = cur_logs
            loop += 1

            

Reported by Pylint.

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

Line: 104 Column: 25

                                  # We should be creating the same log files each time.
                    for l in cur_logs:
                        self.assertEqual(l in last_logs, True)
                    for l in last_logs:
                        self.assertEqual(l in cur_logs, True)
                last_logs = cur_logs
            loop += 1
            # Remove all log files before opening without logging.
            cur_logs = fnmatch.filter(os.listdir(homedir), "*gerLog*")

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_assert02.py
11 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 111 Column: 20

              
        msg = "/timestamp set on this transaction/"
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.assertEquals(c_never.search(), 0), msg)
        self.session.rollback_transaction()
        c_always.close()
        c_def.close()
        c_never.close()
        c_none.close()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 139 Column: 20

              
        msg = "/none set on this transaction/"
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.assertEquals(c_always.search(), 0), msg)
        self.session.rollback_transaction()
        c_always.close()
        c_def.close()
        c_never.close()
        c_none.close()

            

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.

third party import "import wiredtiger, wttest" should be placed before "from suite_subprocess import suite_subprocess"
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'


            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'


            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),
        ('string-row', dict(key_format='S', usestrings=True))

            

Reported by Pylint.

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

Line: 37 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),
        ('string-row', dict(key_format='S', usestrings=True))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def test_read_timestamp(self):
        #if not wiredtiger.diagnostic_build():
        #    self.skipTest('requires a diagnostic build')

        base = 'assert02.'
        base_uri = 'file:' + base

            

Reported by Pylint.

Too many statements (76/50)
Error

Line: 46 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def test_read_timestamp(self):
        #if not wiredtiger.diagnostic_build():
        #    self.skipTest('requires a diagnostic build')

        base = 'assert02.'
        base_uri = 'file:' + base

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_alter04.py
11 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_alter04.py
#    Smoke-test the session alter operations.
#    This test confirms os_cache_dirty_max and os_cache_max.

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_alter04.py
#    Smoke-test the session alter operations.
#    This test confirms os_cache_dirty_max and os_cache_max.

            

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: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_alter04.py
#    Smoke-test the session alter operations.
#    This test confirms os_cache_dirty_max and os_cache_max.

            

Reported by Pylint.

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

Line: 35 Column: 1

              # test_alter04.py
#    Smoke-test the session alter operations.
#    This test confirms os_cache_dirty_max and os_cache_max.
class test_alter04(wttest.WiredTigerTestCase):
    name = "alter04"
    entries = 100
    cache_alter=('1M', '100K')
    # Settings for os_cache[_dirty]_max.
    types = [

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              # test_alter04.py
#    Smoke-test the session alter operations.
#    This test confirms os_cache_dirty_max and os_cache_max.
class test_alter04(wttest.WiredTigerTestCase):
    name = "alter04"
    entries = 100
    cache_alter=('1M', '100K')
    # Settings for os_cache[_dirty]_max.
    types = [

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 62 Column: 5

                  ]
    scenarios = make_scenarios(types, sizes, reopen, settings)

    def verify_metadata(self, metastr):
        if metastr == '':
            return
        cursor = self.session.open_cursor('metadata:', None, None)
        #
        # Walk through all the metadata looking for the entries that are

            

Reported by Pylint.

Comparison 'found == True' should be 'found is True' if checking for the singleton value True, or 'bool(found)' if testing for truthiness
Error

Line: 83 Column: 25

                              found = True
                self.assertTrue(value.find(metastr) != -1)
        cursor.close()
        self.assertTrue(found == True)

    # Alter: Change the setting after creation
    def test_alter04_cache(self):
        uri = self.uri + self.name
        create_params = 'key_format=i,value_format=i,'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 86 Column: 5

                      self.assertTrue(found == True)

    # Alter: Change the setting after creation
    def test_alter04_cache(self):
        uri = self.uri + self.name
        create_params = 'key_format=i,value_format=i,'
        complex_params = ''
        #
        # If we're not explicitly setting the parameter, then don't

            

Reported by Pylint.

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

Line: 120 Column: 9

                          self.session.create(suburi, complex_params + cgparam)

        # Put some data in table.
        c = self.session.open_cursor(uri, None)
        for k in range(self.entries):
            c[k+1] = 1
        c.close()

        # Verify the string in the metadata

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_txn11.py
11 issues
method already defined line 39
Error

Line: 47 Column: 5

                  uri = 'table:' + tablename

    # Turn on logging for this test.
    def conn_config(self):
        return 'log=(archive=%s,' % self.archive + \
            'enabled,file_max=%s,prealloc=false),' % self.logmax + \
            'transaction_sync=(enabled=false),'

    def run_checkpoints(self):

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 47 Column: 5

                  uri = 'table:' + tablename

    # Turn on logging for this test.
    def conn_config(self):
        return 'log=(archive=%s,' % self.archive + \
            'enabled,file_max=%s,prealloc=false),' % self.logmax + \
            'transaction_sync=(enabled=false),'

    def run_checkpoints(self):

            

Reported by Pylint.

Unused import time
Error

Line: 32 Column: 1

              # test_txn11.py
#   Transactions: Empty checkpoints and log archiving

import fnmatch, os, time
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
import wttest

class test_txn11(wttest.WiredTigerTestCase, suite_subprocess):

            

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 (fnmatch, os, time)
Error

Line: 32 Column: 1

              # test_txn11.py
#   Transactions: Empty checkpoints and log archiving

import fnmatch, os, time
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
import wttest

class test_txn11(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

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

Line: 37 Column: 1

              from wtdataset import SimpleDataSet
import wttest

class test_txn11(wttest.WiredTigerTestCase, suite_subprocess):
    archive = 'true'
    conn_config = 'verbose=[transaction]'
    logmax = "100K"
    nrows = 700
    tablename = 'test_txn11'

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              from wtdataset import SimpleDataSet
import wttest

class test_txn11(wttest.WiredTigerTestCase, suite_subprocess):
    archive = 'true'
    conn_config = 'verbose=[transaction]'
    logmax = "100K"
    nrows = 700
    tablename = 'test_txn11'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 47 Column: 5

                  uri = 'table:' + tablename

    # Turn on logging for this test.
    def conn_config(self):
        return 'log=(archive=%s,' % self.archive + \
            'enabled,file_max=%s,prealloc=false),' % self.logmax + \
            'transaction_sync=(enabled=false),'

    def run_checkpoints(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 52 Column: 5

                          'enabled,file_max=%s,prealloc=false),' % self.logmax + \
            'transaction_sync=(enabled=false),'

    def run_checkpoints(self):
        orig_logs = fnmatch.filter(os.listdir(self.home), "*gerLog*")
        checkpoints = 0
        sorig = set(orig_logs)
        while checkpoints < 500:
            self.session.checkpoint()

            

Reported by Pylint.

Useless return at end of function or method
Error

Line: 52 Column: 5

                          'enabled,file_max=%s,prealloc=false),' % self.logmax + \
            'transaction_sync=(enabled=false),'

    def run_checkpoints(self):
        orig_logs = fnmatch.filter(os.listdir(self.home), "*gerLog*")
        checkpoints = 0
        sorig = set(orig_logs)
        while checkpoints < 500:
            self.session.checkpoint()

            

Reported by Pylint.

src/third_party/timelib-2021.06/parse_date.c
11 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              	if(!s->eof){
		unsigned int cnt = s->tok - s->bot;
		if(cnt){
			memcpy(s->bot, s->tok, s->lim - s->tok);
			s->tok = s->bot;
			s->ptr -= cnt;
			cursor -= cnt;
			s->pos -= cnt;
			s->lim -= cnt;

            

Reported by FlawFinder.

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

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

              		}
		if((s->top - s->lim) < BSIZE){
			uchar *buf = (uchar*) timelib_malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
			memcpy(buf, s->tok, s->lim - s->tok);
			s->tok = buf;
			s->ptr = &buf[s->ptr - s->bot];
			cursor = &buf[cursor - s->bot];
			s->pos = &buf[s->pos - s->bot];
			s->lim = &buf[s->lim - s->bot];

            

Reported by FlawFinder.

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

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

              static char *timelib_string(Scanner *s)
{
	char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
	memcpy(tmp, s->tok, s->cur - s->tok);

	return tmp;
}

static timelib_sll timelib_get_nr_ex(const char **ptr, int max_length, int *scanned_length)

            

Reported by FlawFinder.

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

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

              		*scanned_length = end - begin;
	}
	str = timelib_calloc(1, end - begin + 1);
	memcpy(str, begin, end - begin);
	tmp_nr = strtoll(str, NULL, 10);
	timelib_free(str);
	return tmp_nr;
}


            

Reported by FlawFinder.

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

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

              	}
	end = *ptr;
	str = timelib_calloc(1, end - begin);
	memcpy(str, begin + 1, end - begin - 1);
	tmp_nr = strtod(str, NULL) * pow(10, 7 - (end - begin));
	timelib_free(str);
	return tmp_nr;
}


            

Reported by FlawFinder.

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

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

              	}
	end = *ptr;
	word = timelib_calloc(1, end - begin + 1);
	memcpy(word, begin, end - begin);

	for (tp = timelib_reltext_lookup; tp->name; tp++) {
		if (timelib_strcasecmp(word, tp->name) == 0) {
			value = tp->value;
			*behavior = tp->type;

            

Reported by FlawFinder.

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

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

              	}
	end = *ptr;
	word = timelib_calloc(1, end - begin + 1);
	memcpy(word, begin, end - begin);

	for (tp = timelib_month_lookup; tp->name; tp++) {
		if (timelib_strcasecmp(word, tp->name) == 0) {
			value = tp->value;
		}

            

Reported by FlawFinder.

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

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

              	}
	end = *ptr;
	word = timelib_calloc(1, end - begin + 1);
	memcpy(word, begin, end - begin);

	for (tp = timelib_relunit_lookup; tp->name; tp++) {
		if (timelib_strcasecmp(word, tp->name) == 0) {
			value = tp;
			break;

            

Reported by FlawFinder.

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

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

              	}
	end = *ptr;
	word = timelib_calloc(1, end - begin + 1);
	memcpy(word, begin, end - begin);

	if ((tp = abbr_search(word, -1, 0))) {
		value = tp->gmtoffset;
		*dst = tp->type;
		value -= tp->type * 3600;

            

Reported by FlawFinder.

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

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

              
	in.str = timelib_malloc((e - s) + YYMAXFILL);
	memset(in.str, 0, (e - s) + YYMAXFILL);
	memcpy(in.str, s, (e - s));
	in.lim = in.str + (e - s) + YYMAXFILL;
	in.cur = in.str;
	in.time = timelib_time_ctor();
	in.time->y = TIMELIB_UNSET;
	in.time->d = TIMELIB_UNSET;

            

Reported by FlawFinder.

site_scons/site_tools/mongo_libfuzzer.py
11 issues
Unable to import 'SCons.Script'
Error

Line: 25 Column: 1

              
"""Pseudo-builders for building and registering libfuzzer tests.
"""
from SCons.Script import Action


def exists(env):
    return True


            

Reported by Pylint.

Undefined variable '_libfuzzer_tests'
Error

Line: 34 Column: 18

              
def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:
        for s in _libfuzzer_tests:
            print("\t" + str(s))
            ofile.write("%s\n" % s)


def build_cpp_libfuzzer_test(env, target, source, **kwargs):

            

Reported by Pylint.

Unused Action imported from SCons.Script
Error

Line: 25 Column: 1

              
"""Pseudo-builders for building and registering libfuzzer tests.
"""
from SCons.Script import Action


def exists(env):
    return True


            

Reported by Pylint.

Unused argument 'env'
Error

Line: 28 Column: 12

              from SCons.Script import Action


def exists(env):
    return True


def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 32 Column: 53

                  return True


def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:
        for s in _libfuzzer_tests:
            print("\t" + str(s))
            ofile.write("%s\n" % s)


            

Reported by Pylint.

Unused argument 'env'
Error

Line: 32 Column: 40

                  return True


def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:
        for s in _libfuzzer_tests:
            print("\t" + str(s))
            ofile.write("%s\n" % s)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 1

              from SCons.Script import Action


def exists(env):
    return True


def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 32 Column: 1

                  return True


def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:
        for s in _libfuzzer_tests:
            print("\t" + str(s))
            ofile.write("%s\n" % s)


            

Reported by Pylint.

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

Line: 34 Column: 13

              
def libfuzzer_test_list_builder_action(env, target, source):
    with open(str(target[0]), "w") as ofile:
        for s in _libfuzzer_tests:
            print("\t" + str(s))
            ofile.write("%s\n" % s)


def build_cpp_libfuzzer_test(env, target, source, **kwargs):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 39 Column: 1

                          ofile.write("%s\n" % s)


def build_cpp_libfuzzer_test(env, target, source, **kwargs):
    myenv = env.Clone()
    if not myenv.IsSanitizerEnabled("fuzzer"):
        return []

    libdeps = kwargs.get("LIBDEPS", myenv.get("LIBDEPS", [])).copy()

            

Reported by Pylint.

src/third_party/boost/libs/smart_ptr/extras/src/sp_collector.cpp
11 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: 78 Column: 87 CWE codes: 362

              
typedef std::deque<void const *> open_type;

static void scan_and_mark(void const * area, size_t size, map2_type & m2, open_type & open)
{
    unsigned char const * p = static_cast<unsigned char const *>(area);

    for(size_t n = 0; n + sizeof(shared_ptr_layout) <= size; p += pointer_align, n += pointer_align)
    {

            

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: 88 Column: 13 CWE codes: 362

              
        if(q->pn.id == boost::detail::shared_count_id && q->pn.pi != 0 && m2.count(q->pn.pi) != 0)
        {
            open.push_back(q->pn.pi);
            m2.erase(q->pn.pi);
        }
    }
}


            

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

                  // mark reachable objects

    {
        open_type open;

        for(map2_type::iterator i = m2.begin(); i != m2.end(); ++i)
        {
            boost::detail::sp_counted_base const * p = static_cast<boost::detail::sp_counted_base const *>(i->first);
            if(p->use_count() != i->second) open.push_back(p);

            

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: 123 Column: 45 CWE codes: 362

                      for(map2_type::iterator i = m2.begin(); i != m2.end(); ++i)
        {
            boost::detail::sp_counted_base const * p = static_cast<boost::detail::sp_counted_base const *>(i->first);
            if(p->use_count() != i->second) open.push_back(p);
        }

        std::cout << "... " << open.size() << " objects in open.\n";

        for(open_type::iterator j = open.begin(); j != open.end(); ++j)

            

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: 126 Column: 32 CWE codes: 362

                          if(p->use_count() != i->second) open.push_back(p);
        }

        std::cout << "... " << open.size() << " objects in open.\n";

        for(open_type::iterator j = open.begin(); j != open.end(); ++j)
        {
            m2.erase(*j);
        }

            

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: 128 Column: 37 CWE codes: 362

              
        std::cout << "... " << open.size() << " objects in open.\n";

        for(open_type::iterator j = open.begin(); j != open.end(); ++j)
        {
            m2.erase(*j);
        }

        while(!open.empty())

            

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: 128 Column: 56 CWE codes: 362

              
        std::cout << "... " << open.size() << " objects in open.\n";

        for(open_type::iterator j = open.begin(); j != open.end(); ++j)
        {
            m2.erase(*j);
        }

        while(!open.empty())

            

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: 133 Column: 16 CWE codes: 362

                          m2.erase(*j);
        }

        while(!open.empty())
        {
            void const * p = open.front();
            open.pop_front();

            map_type::const_iterator i = m.find(p);

            

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: 135 Column: 30 CWE codes: 362

              
        while(!open.empty())
        {
            void const * p = open.front();
            open.pop_front();

            map_type::const_iterator i = m.find(p);
            BOOST_ASSERT(i != m.end());


            

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: 136 Column: 13 CWE codes: 362

                      while(!open.empty())
        {
            void const * p = open.front();
            open.pop_front();

            map_type::const_iterator i = m.find(p);
            BOOST_ASSERT(i != m.end());

            scan_and_mark(i->second.first, i->second.second, m2, open);

            

Reported by FlawFinder.