The following issues were found

src/third_party/boost/libs/locale/src/shared/message.cpp
10 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: 72 Column: 22 CWE codes: 362

              
                #if defined(BOOST_WINDOWS)

                bool open(std::string const &file_name,std::string const &encoding)
                {
                    close();

                    //
                    // Under windows we have to use "_wfopen" to get

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 94 Column: 22 CWE codes: 362

              
                // We do not use encoding as we use native file name encoding
                
                bool open(std::string const &file_name,std::string const &/* encoding */)
                {
                    close();

                    file = fopen(file_name.c_str(),"rb");


            

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

                              {
                    close();

                    file = fopen(file_name.c_str(),"rb");

                    return file!=0;
                }

                #endif

            

Reported by FlawFinder.

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

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

                                  if(file_size_ < 4 )
                        throw std::runtime_error("invalid 'mo' file format - the file is too short");
                    uint32_t magic=0;
                    memcpy(&magic,data_,4);
                    if(magic == 0x950412de)
                        native_byteorder_ = true;
                    else if(magic == 0xde120495)
                        native_byteorder_ = false;
                    else

            

Reported by FlawFinder.

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

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

                                  if(offset > file_size_ - 4) {
                        throw std::runtime_error("Bad mo-file format");
                    }
                    memcpy(&tmp,data_ + offset,4);
                    convert(tmp);
                    return tmp;
                }

                void convert(uint32_t &v) const

            

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: 641 Column: 34 CWE codes: 362

                                  }
                    else {
                        c_file the_file;
                        the_file.open(file_name,locale_encoding);
                        if(!the_file.file)
                            return false;
                        mo.reset(new mo_file(the_file.file));
                    }
                    

            

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: 166 Column: 43 CWE codes: 126

                                  if(cntx == 0)
                        return strcmp(real_key,key) == 0;
                    else {
                        size_t real_len = strlen(real_key);
                        size_t cntx_len = strlen(cntx);
                        size_t key_len = strlen(key);
                        if(cntx_len + 1 + key_len != real_len)
                            return false;
                        return 

            

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: 167 Column: 43 CWE codes: 126

                                      return strcmp(real_key,key) == 0;
                    else {
                        size_t real_len = strlen(real_key);
                        size_t cntx_len = strlen(cntx);
                        size_t key_len = strlen(key);
                        if(cntx_len + 1 + key_len != real_len)
                            return false;
                        return 
                            memcmp(real_key,cntx,cntx_len) == 0

            

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: 168 Column: 42 CWE codes: 126

                                  else {
                        size_t real_len = strlen(real_key);
                        size_t cntx_len = strlen(cntx);
                        size_t key_len = strlen(key);
                        if(cntx_len + 1 + key_len != real_len)
                            return false;
                        return 
                            memcmp(real_key,cntx,cntx_len) == 0
                            && real_key[cntx_len] == '\4'

            

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: 667 Column: 66 CWE codes: 126

                                      converter<CharType> cvt_key(key_encoding,mo_encoding);
                        for(unsigned i=0;i<mo->size();i++) {
                            char const *ckey = mo->key(i);
                            string_type skey = cvt_key(ckey,ckey+strlen(ckey));
                            key_type key(skey);
                            
                            mo_file::pair_type tmp = mo->value(i);
                            string_type value = cvt_value(tmp.first,tmp.second);
                            catalogs_[id][key].swap(value);

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_rollback_to_stable24.py
10 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_rollback_to_stable24.py
# Exercise a recno-counting bug in column store.
#

            

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_rollback_to_stable24.py
# Exercise a recno-counting bug in column store.
#

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 74 Column: 9

                  def test_rollback_to_stable24(self):
        # Create a table without logging.
        uri = "table:rollback_to_stable24"
        format = 'key_format={},value_format=S'.format(self.key_format)
        self.session.create(uri, format + ', log=(enabled=false)')

        # Pin oldest timestamp to 10.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(10))


            

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_rollback_to_stable24.py
# Exercise a recno-counting bug in column store.
#

            

Reported by Pylint.

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

Line: 60 Column: 1

              #
# Run this test on rows as well as columns to help make sure the test itself is valid (and
# stays so over time...)
class test_rollback_to_stable24(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'
    conn_config = 'in_memory=false'

    key_format_values = [
        ('column', dict(key_format='r')),

            

Reported by Pylint.

Missing class docstring
Error

Line: 60 Column: 1

              #
# Run this test on rows as well as columns to help make sure the test itself is valid (and
# stays so over time...)
class test_rollback_to_stable24(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'
    conn_config = 'in_memory=false'

    key_format_values = [
        ('column', dict(key_format='r')),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 71 Column: 5

              
    scenarios = make_scenarios(key_format_values)

    def test_rollback_to_stable24(self):
        # Create a table without logging.
        uri = "table:rollback_to_stable24"
        format = 'key_format={},value_format=S'.format(self.key_format)
        self.session.create(uri, format + ', log=(enabled=false)')


            

Reported by Pylint.

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

Line: 88 Column: 9

                      value_c = "ccccc" * 100
        value_d = "ddddd" * 100

        s = self.conn.open_session()
        cursor = s.open_cursor(uri)

        # Write some keys at time 10.
        s.begin_transaction()
        cursor[1] = value_a

            

Reported by Pylint.

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

Line: 110 Column: 9

                      evict_cursor = self.session.open_cursor(uri, None, "debug=(release_evict)")
        s.begin_transaction()
        # Search the key to evict it.
        v = evict_cursor[1]
        self.assertEqual(v, value_a)
        self.assertEqual(evict_cursor.reset(), 0)
        s.rollback_transaction()
        evict_cursor.close()


            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/zip.py
10 issues
Redefining built-in 'zip'
Error

Line: 46 Column: 1

              import zipfile

zipcompression = zipfile.ZIP_DEFLATED
def zip(target, source, env):
    compression = env.get('ZIPCOMPRESSION', 0)
    zf = zipfile.ZipFile(str(target[0]), 'w', compression)
    for s in source:
        if s.isdir():
            for dirpath, dirnames, filenames in os.walk(str(s)):

            

Reported by Pylint.

Unused variable 'dirnames'
Error

Line: 51 Column: 26

                  zf = zipfile.ZipFile(str(target[0]), 'w', compression)
    for s in source:
        if s.isdir():
            for dirpath, dirnames, filenames in os.walk(str(s)):
                for fname in filenames:
                    path = os.path.join(dirpath, fname)
                    if os.path.isfile(path):

                        zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', ''))))

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 85 Column: 12

                  env['ZIPSUFFIX']  = '.zip'
    env['ZIPROOT']    = SCons.Util.CLVar('')

def exists(env):
    return True

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

            

Reported by Pylint.

Line too long (114/100)
Error

Line: 34 Column: 1

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

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

import os.path

import SCons.Builder
import SCons.Defaults

            

Reported by Pylint.

standard import "import zipfile" should be placed before "import SCons.Builder"
Error

Line: 43 Column: 1

              import SCons.Node.FS
import SCons.Util

import zipfile

zipcompression = zipfile.ZIP_DEFLATED
def zip(target, source, env):
    compression = env.get('ZIPCOMPRESSION', 0)
    zf = zipfile.ZipFile(str(target[0]), 'w', compression)

            

Reported by Pylint.

Constant name "zipcompression" doesn't conform to UPPER_CASE naming style
Error

Line: 45 Column: 1

              
import zipfile

zipcompression = zipfile.ZIP_DEFLATED
def zip(target, source, env):
    compression = env.get('ZIPCOMPRESSION', 0)
    zf = zipfile.ZipFile(str(target[0]), 'w', compression)
    for s in source:
        if s.isdir():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 1

              import zipfile

zipcompression = zipfile.ZIP_DEFLATED
def zip(target, source, env):
    compression = env.get('ZIPCOMPRESSION', 0)
    zf = zipfile.ZipFile(str(target[0]), 'w', compression)
    for s in source:
        if s.isdir():
            for dirpath, dirnames, filenames in os.walk(str(s)):

            

Reported by Pylint.

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

Line: 48 Column: 5

              zipcompression = zipfile.ZIP_DEFLATED
def zip(target, source, env):
    compression = env.get('ZIPCOMPRESSION', 0)
    zf = zipfile.ZipFile(str(target[0]), 'w', compression)
    for s in source:
        if s.isdir():
            for dirpath, dirnames, filenames in os.walk(str(s)):
                for fname in filenames:
                    path = os.path.join(dirpath, fname)

            

Reported by Pylint.

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

Line: 49 Column: 9

              def zip(target, source, env):
    compression = env.get('ZIPCOMPRESSION', 0)
    zf = zipfile.ZipFile(str(target[0]), 'w', compression)
    for s in source:
        if s.isdir():
            for dirpath, dirnames, filenames in os.walk(str(s)):
                for fname in filenames:
                    path = os.path.join(dirpath, fname)
                    if os.path.isfile(path):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 85 Column: 1

                  env['ZIPSUFFIX']  = '.zip'
    env['ZIPROOT']    = SCons.Util.CLVar('')

def exists(env):
    return True

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

            

Reported by Pylint.

src/third_party/mozjs-60/include/mozilla/FStream.h
10 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: 40 Column: 8 CWE codes: 362

                std::filebuf* rdbuf() const { return mFileBuf.get(); }

  bool is_open() const { return mFileBuf && mFileBuf->is_open(); }
  void open(char16ptr_t filename, openmode mode = in);
  void close() { mFileBuf && mFileBuf->close(); }

private:
  UniquePtr<std::filebuf> mFileBuf;
};

            

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: 51 Column: 3 CWE codes: 362

              IFStream::IFStream(char16ptr_t filename, openmode mode)
  : std::istream(nullptr)
{
  open(filename, mode);
}

inline void
IFStream::open(char16ptr_t filename, openmode mode)
{

            

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: 55 Column: 11 CWE codes: 362

              }

inline void
IFStream::open(char16ptr_t filename, openmode mode)
{
  int fmode = _O_RDONLY;
  if (mode & binary) {
    fmode |= _O_BINARY;
  } else {

            

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: 76 Column: 8 CWE codes: 362

                std::filebuf* rdbuf() const { return mFileBuf.get(); }

  bool is_open() const { return mFileBuf && mFileBuf->is_open(); }
  void open(char16ptr_t filename, openmode mode = out);
  void close() { mFileBuf && mFileBuf->close(); }

private:
  UniquePtr<std::filebuf> mFileBuf;
};

            

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: 87 Column: 3 CWE codes: 362

              OFStream::OFStream(char16ptr_t filename, openmode mode)
  : std::ostream(nullptr)
{
  open(filename, mode);
}

inline void
OFStream::open(char16ptr_t filename, openmode mode)
{

            

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: 91 Column: 11 CWE codes: 362

              }

inline void
OFStream::open(char16ptr_t filename, openmode mode)
{
  int fmode = _O_WRONLY;
  if (mode & binary) {
    fmode |= _O_BINARY;
  } else {

            

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: 114 Column: 8 CWE codes: 362

                explicit IFStream(char16ptr_t filename, openmode mode = in)
    : std::ifstream(filename, mode) {}

  void open(char16ptr_t filename, openmode mode = in)
  {
    std::ifstream::open(filename, mode);
  }
};


            

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: 116 Column: 20 CWE codes: 362

              
  void open(char16ptr_t filename, openmode mode = in)
  {
    std::ifstream::open(filename, mode);
  }
};

class OFStream : public std::ofstream
{

            

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: 8 CWE codes: 362

                explicit OFStream(char16ptr_t filename, openmode mode = out)
    : std::ofstream(filename, mode) {}

  void open(char16ptr_t filename, openmode mode = out)
  {
    std::ofstream::open(filename, mode);
  }
};
#else

            

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

              
  void open(char16ptr_t filename, openmode mode = out)
  {
    std::ofstream::open(filename, mode);
  }
};
#else
using IFStream = std::ifstream;
using OFStream = std::ofstream;

            

Reported by FlawFinder.

site_scons/site_tools/ccache.py
10 issues
Unable to import 'SCons'
Error

Line: 28 Column: 1

              import re
import subprocess

import SCons
from pkg_resources import parse_version

# This is the oldest version of ccache that offers support for -gsplit-dwarf
_ccache_version_min = parse_version("3.2.3")


            

Reported by Pylint.

Unused import math
Error

Line: 23 Column: 1

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

import math
import os
import re
import subprocess

import SCons

            

Reported by Pylint.

Access to a protected member _subproc of a client class
Error

Line: 48 Column: 12

                  if 'CCACHE_VERSION' in env and env['CCACHE_VERSION'] >= _ccache_version_min:
        return True

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

            

Reported by Pylint.

TODO: https://github.com/icecc/icecream/issues/550
Error

Line: 133 Column: 3

                          # cause of these build failures. Once the bug is resolved and
            # the fix is deployed, we can remove this entire conditional
            # branch and make it like the one for clang.
            # TODO: https://github.com/icecc/icecream/issues/550
            env["ENV"].pop("CCACHE_CPP2", None)
            env["ENV"]["CCACHE_NOCPP2"] = "1"
        else:
            env["ENV"].pop("CCACHE_NOCPP2", None)
            env["ENV"]["CCACHE_CPP2"] = "1"

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 160 Column: 34

                  # too late for us to meaningfully filter out conftests. So we just
    # disable ccache for conftests entirely.  Which feels safer
    # somehow anyway.
    def ccache_generator(target, source, env, for_signature):
        if "conftest" not in str(target[0]):
            return '$CCACHE'
        return ''
    env['CCACHE_GENERATOR'] = ccache_generator


            

Reported by Pylint.

Unused argument 'env'
Error

Line: 160 Column: 42

                  # too late for us to meaningfully filter out conftests. So we just
    # disable ccache for conftests entirely.  Which feels safer
    # somehow anyway.
    def ccache_generator(target, source, env, for_signature):
        if "conftest" not in str(target[0]):
            return '$CCACHE'
        return ''
    env['CCACHE_GENERATOR'] = ccache_generator


            

Reported by Pylint.

Unused argument 'for_signature'
Error

Line: 160 Column: 47

                  # too late for us to meaningfully filter out conftests. So we just
    # disable ccache for conftests entirely.  Which feels safer
    # somehow anyway.
    def ccache_generator(target, source, env, for_signature):
        if "conftest" not in str(target[0]):
            return '$CCACHE'
        return ''
    env['CCACHE_GENERATOR'] = ccache_generator


            

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.

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 math
import os
import re
import subprocess

import SCons
from pkg_resources import parse_version

# This is the oldest version of ccache that offers support for -gsplit-dwarf

            

Reported by Bandit.

Line too long (105/100)
Error

Line: 78 Column: 1

                  if validated:
        env['CCACHE_VERSION'] = ccache_version
    else:
        print(f"Error: failed to verify ccache version >= {_ccache_version_min}, found {ccache_version}")

    return validated


def generate(env):

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs22.py
10 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_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.

            

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_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.

            

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_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.

            

Reported by Pylint.

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

Line: 35 Column: 1

              # test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.
class test_hs22(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB'
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r', key1=1, key2=2)),

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              # test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.
class test_hs22(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB'
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r', key1=1, key2=2)),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 5

              
    scenarios = make_scenarios(key_format_values)

    def test_onpage_out_of_order_timestamp_update(self):
        uri = 'table:test_hs22'
        self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

            

Reported by Pylint.

Line too long (103/100)
Error

Line: 51 Column: 1

                      self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

        key1 = self.key1
        key2 = self.key2

        value1 = 'a'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 104 Column: 5

                      self.assertEqual(cursor[key1], value2)
        self.session.rollback_transaction()

    def test_out_of_order_timestamp_update_newer_than_tombstone(self):
        uri = 'table:test_hs22'
        self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

            

Reported by Pylint.

Line too long (103/100)
Error

Line: 109 Column: 1

                      self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

        key1 = self.key1
        key2 = self.key2

        value1 = 'a'

            

Reported by Pylint.

src/third_party/boost/libs/locale/src/encoding/codepage.cpp
10 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: 46 Column: 29 CWE codes: 362

                                  hold_ptr<converter_between> cvt;
                    #ifdef BOOST_LOCALE_WITH_ICONV
                    cvt.reset(new iconv_between());
                    if(cvt->open(to_charset,from_charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    #ifdef BOOST_LOCALE_WITH_ICU
                    cvt.reset(new uconv_between());
                    if(cvt->open(to_charset,from_charset,how))

            

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: 51 Column: 29 CWE codes: 362

                                  #endif
                    #ifdef BOOST_LOCALE_WITH_ICU
                    cvt.reset(new uconv_between());
                    if(cvt->open(to_charset,from_charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    #ifdef BOOST_LOCALE_WITH_WCONV
                    cvt.reset(new wconv_between());
                    if(cvt->open(to_charset,from_charset,how))

            

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

                                  #endif
                    #ifdef BOOST_LOCALE_WITH_WCONV
                    cvt.reset(new wconv_between());
                    if(cvt->open(to_charset,from_charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    throw invalid_charset_error(std::string(to_charset) + " or " + from_charset);
                }


            

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: 72 Column: 29 CWE codes: 362

                                  hold_ptr<converter_to_utf<CharType> > cvt;
                    #ifdef BOOST_LOCALE_WITH_ICONV
                    cvt.reset(new iconv_to_utf<CharType>());
                    if(cvt->open(charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    #ifdef BOOST_LOCALE_WITH_ICU
                    cvt.reset(new uconv_to_utf<CharType>());
                    if(cvt->open(charset,how))

            

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: 77 Column: 29 CWE codes: 362

                                  #endif
                    #ifdef BOOST_LOCALE_WITH_ICU
                    cvt.reset(new uconv_to_utf<CharType>());
                    if(cvt->open(charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    #ifdef BOOST_LOCALE_WITH_WCONV
                    cvt.reset(new wconv_to_utf<CharType>());
                    if(cvt->open(charset,how))

            

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: 82 Column: 29 CWE codes: 362

                                  #endif
                    #ifdef BOOST_LOCALE_WITH_WCONV
                    cvt.reset(new wconv_to_utf<CharType>());
                    if(cvt->open(charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    throw invalid_charset_error(charset);
                }


            

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: 98 Column: 29 CWE codes: 362

                                  hold_ptr<converter_from_utf<CharType> > cvt;
                    #ifdef BOOST_LOCALE_WITH_ICONV
                    cvt.reset(new iconv_from_utf<CharType>());
                    if(cvt->open(charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    #ifdef BOOST_LOCALE_WITH_ICU
                    cvt.reset(new uconv_from_utf<CharType>());
                    if(cvt->open(charset,how))

            

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: 103 Column: 29 CWE codes: 362

                                  #endif
                    #ifdef BOOST_LOCALE_WITH_ICU
                    cvt.reset(new uconv_from_utf<CharType>());
                    if(cvt->open(charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    #ifdef BOOST_LOCALE_WITH_WCONV
                    cvt.reset(new wconv_from_utf<CharType>());
                    if(cvt->open(charset,how))

            

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: 108 Column: 29 CWE codes: 362

                                  #endif
                    #ifdef BOOST_LOCALE_WITH_WCONV
                    cvt.reset(new wconv_from_utf<CharType>());
                    if(cvt->open(charset,how))
                        return cvt->convert(begin,end);
                    #endif
                    throw invalid_charset_error(charset);
                }


            

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: 117 Column: 42 CWE codes: 126

                              std::string normalize_encoding(char const *ccharset)
                {
                    std::string charset;
                    charset.reserve(std::strlen(ccharset));
                    while(*ccharset!=0) {
                        char c=*ccharset++;
                        if('0' <= c && c<= '9')
                            charset+=c;
                        else if('a' <=c && c <='z')

            

Reported by FlawFinder.

buildscripts/gdb/udb.py
10 issues
Unable to import 'gdb'
Error

Line: 7 Column: 1

              import os
import re
from typing import Optional
import gdb

# Pattern to match output of 'info files'
PATTERN_ELF_SECTIONS = re.compile(
    r'(?P<begin>[0x0-9a-fA-F]+)\s-\s(?P<end>[0x0-9a-fA-F]+)\s\bis\b\s(?P<section>\.[a-z]+$)')


            

Reported by Pylint.

Unused Optional imported from typing
Error

Line: 6 Column: 1

              # pylint: disable=unused-argument,missing-docstring,no-self-use
import os
import re
from typing import Optional
import gdb

# Pattern to match output of 'info files'
PATTERN_ELF_SECTIONS = re.compile(
    r'(?P<begin>[0x0-9a-fA-F]+)\s-\s(?P<end>[0x0-9a-fA-F]+)\s\bis\b\s(?P<section>\.[a-z]+$)')

            

Reported by Pylint.

TODO duplicate fnames?
Error

Line: 87 Column: 3

                      if section not in ('.text', '.data', '.bss'):
            continue
        begin = match.group('begin')
        # TODO duplicate fnames?
        fname = os.path.basename(match.group('file'))

        if fname.startswith("system-supplied DSO") or match.group('file').startswith(
                "/lib") or match.group('file').startswith("/usr/lib"):
            continue

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 40 Column: 1

                  gdb.execute(cmd, to_string=True)


class LoadDebugFile(gdb.Command):
    """Loads the debug symbol file with the correct address for .text, .data and .bss sections."""

    def __init__(self):
        """GDB Command API init."""
        super(LoadDebugFile, self).__init__('load-debug-symbols', gdb.COMPLETE_EXPRESSION)

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 45 Column: 9

              
    def __init__(self):
        """GDB Command API init."""
        super(LoadDebugFile, self).__init__('load-debug-symbols', gdb.COMPLETE_EXPRESSION)

    def invoke(self, args, from_tty):
        """GDB Command API invoke."""
        arglist = args.split()
        if len(arglist) != 1:

            

Reported by Pylint.

Line too long (114/100)
Error

Line: 69 Column: 1

              LoadDebugFile()

PATTERN_ELF_SOLIB_SECTIONS = re.compile(
    r'(?P<begin>[0x0-9a-fA-F]+)\s-\s(?P<end>[0x0-9a-fA-F]+)\s\bis\b\s(?P<section>\.[a-z]+)\s\bin\b\s(?P<file>.*$)'
)


def parse_solib_sections():
    """Find addresses for .text, .data, and .bss sections."""

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 106 Column: 1

              

def find_dwarf_files(path):
    """Given a directory, collect a list of files in it that pass the is_probably_dwarf_file test."""
    out = []
    for fname in os.listdir(path):
        full_path = os.path.join(path, fname)
        if is_probably_dwarf_file(full_path):
            out.append(full_path)

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 115 Column: 1

                  return out


SOLIB_SEARCH_PATH_PREFIX = "The search path for loading non-absolute shared library symbol files is "


def extend_solib_search_path(new_path: str):
    """Extend solib-search-path."""
    solib_search_path = gdb.execute("show solib-search-path", to_string=True)

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 156 Column: 9

              
    def __init__(self):
        """GDB Command API init."""
        super(LoadDistTest, self).__init__('load-dist-test', gdb.COMPLETE_EXPRESSION)

        try:
            # test if we're running udb
            gdb.execute("help uinfo", to_string=True)
            self._is_udb = True

            

Reported by Pylint.

Line too long (172/100)
Error

Line: 255 Column: 1

              
        if yell_at_user_main_bin:
            print(
                f"Failed to automagically locate debug symbols for main binary. Try loading them manually, 'load-debug-symbols {dist_test}/bin/[your_binary_symbols.debug]'"
            )
            print("^^^^^^ HEY LISTEN ^^^^^^")


LoadDistTest()

            

Reported by Pylint.

site_scons/mongo/generators.py
10 issues
Unused argument 'target'
Error

Line: 91 Column: 35

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 91 Column: 43

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Unused argument 'for_signature'
Error

Line: 91 Column: 56

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 104
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

              
    # Hash the named options and their values, and take the first 8 characters of the hash as
    # the variant name
    hasher = hashlib.md5()
    for option in variant_options:
        hasher.update(option.encode('utf-8'))
        hasher.update(str(env.GetOption(option)).encode('utf-8'))
    variant_dir = str(hasher.hexdigest()[0:8])


            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- mode: python; -*-

import hashlib

# Default and alternative generator definitions go here.

# This is the key/value mapping that will be returned by the buildInfo command and
# printed by the --version command-line option to mongod.
# Each mapped value is in turn a dict consisting of:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

              #   inVersion: <bool> : should it be included in --version output
# The `value` field will be passed through env.subst, so you can use any SCons variables you
# want to define them.
def default_buildinfo_environment_data():
    data = (
        (
            'distmod',
            '$MONGO_DISTMOD',
            True,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 87 Column: 1

              
# If you want buildInfo and --version to be relatively empty, set
# MONGO_BUILDINFO_ENVIRONMENT_DATA = empty_buildinfo_environment_data()
def empty_buildinfo_environment_data():
    return {}


def default_variant_dir_generator(target, source, env, for_signature):


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 91 Column: 1

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Comparison 'env.GetOption('cache') != None' should be 'env.GetOption('cache') is not None'
Error

Line: 93 Column: 8

              
def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.
    variant_options = [
        'opt',

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 122 Column: 1

                  return known_variant_hashes.get(variant_dir, variant_dir)


def os_specific_variant_dir_generator(target, source, env, for_signature):
    return '-'.join([
        env['TARGET_OS'],
        default_variant_dir_generator(target, source, env, for_signature)])

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs13.py
10 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_hs13.py
# Verify reverse modify traversal after eviction.
class test_hs13(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused variable 'value3'
Error

Line: 48 Column: 9

                      create_params = 'value_format=S,key_format={}'.format(self.key_format)
        value1 = 'a' * 10000
        value2 = 'b' * 10000
        value3 = 'e' * 10000

        self.session.create(uri, create_params)
        cursor = self.session.open_cursor(uri)
        session2 = self.setUpSessionOpen(self.conn)
        cursor2 = session2.open_cursor(uri)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 70 Column: 9

                      session2.begin_transaction()
        cursor2.set_key(1)
        cursor2.search()
        self.assertEquals(cursor2.get_value(),  'A' + value1)
        session2.commit_transaction()

        # Reset the cursor.
        cursor2.reset()


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 96 Column: 9

                      # and evict the page.
        evict_cursor = self.session.open_cursor(uri, None, "debug=(release_evict)")
        evict_cursor.set_key(1)
        self.assertEquals(evict_cursor.search(), 0)
        evict_cursor.reset()

        # Try to find the value we saw earlier.
        cursor2.set_key(1)
        cursor2.search()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 102 Column: 9

                      # Try to find the value we saw earlier.
        cursor2.set_key(1)
        cursor2.search()
        self.assertEquals(cursor2.get_value(), 'A' + value1)

if __name__ == '__main__':
    wttest.run()

            

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_hs13.py
# Verify reverse modify traversal after eviction.
class test_hs13(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_hs13.py
# Verify reverse modify traversal after eviction.
class test_hs13(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=2MB,eviction=(threads_max=1)'
    session_config = 'isolation=snapshot'
    key_format_values = [
        ('column', dict(key_format='r')),
        ('integer-row', dict(key_format='i'))

            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_hs13.py
# Verify reverse modify traversal after eviction.
class test_hs13(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=2MB,eviction=(threads_max=1)'
    session_config = 'isolation=snapshot'
    key_format_values = [
        ('column', dict(key_format='r')),
        ('integer-row', dict(key_format='i'))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def test_reverse_modifies_constructed_after_eviction(self):
        uri = "table:test_hs13"
        create_params = 'value_format=S,key_format={}'.format(self.key_format)
        value1 = 'a' * 10000
        value2 = 'b' * 10000
        value3 = 'e' * 10000

            

Reported by Pylint.