The following issues were found

src/third_party/wiredtiger/test/suite/test_cursor_random02.py
17 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 wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_cursor_random02.py
#    Cursor next_random operations

            

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 wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_cursor_random02.py
#    Cursor next_random operations

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 73 Column: 13

              
        cursor = self.session.open_cursor(uri, None, 'next_random=true')
        lastKey = None
        for i in range(0, num_entries):
            self.assertEqual(cursor.next(), 0)
            current = cursor.get_key()
            current = int(current)
            visitedKeys[current] = visitedKeys[current] + 1
            if lastKey != None:

            

Reported by Pylint.

String statement has no effect
Error

Line: 87 Column: 9

              
        #print visitedKeys
        #print differentKeys
        '''
        self.tty('differentKeys: ' + str(differentKeys) + ' of ' + \
            str(num_entries) + ', ' + \
            str((int)((differentKeys * 100) // num_entries)) + '%')
        '''
        # Can't test for non-sequential data when there is 1 item in the table

            

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 wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_cursor_random02.py
#    Cursor next_random operations

            

Reported by Pylint.

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

Line: 35 Column: 1

              
# test_cursor_random02.py
#    Cursor next_random operations
class test_cursor_random02(wttest.WiredTigerTestCase):
    types = [
        ('lsm', dict(type='lsm:random')),
        ('table', dict(type='table:random'))
    ]
    config = [

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              
# test_cursor_random02.py
#    Cursor next_random operations
class test_cursor_random02(wttest.WiredTigerTestCase):
    types = [
        ('lsm', dict(type='lsm:random')),
        ('table', dict(type='table:random'))
    ]
    config = [

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 55 Column: 5

              
    # Check that next_random works in the presence of a larger set of values,
    # where the values are in an insert list.
    def test_cursor_random_reasonable_distribution(self):
        uri = self.type
        num_entries = self.records
        if uri == 'table:random':
            config = 'leaf_page_max=100MB'
        else:

            

Reported by Pylint.

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

Line: 64 Column: 9

                          config = ''

        # Set the leaf-page-max value, otherwise the page might split.
        ds = SimpleDataSet(self, uri, num_entries, config=config)
        ds.populate()
        # Setup an array to track which keys are seen
        visitedKeys = [0] * (num_entries + 1)
        # Setup a counter to see when we find a sequential key
        sequentialKeys = 0

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_prepare04.py
17 issues
Unable to import 'wiredtiger'
Error

Line: 35 Column: 1

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

def timestamp_str(t):
    return '%x' % t


            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 110 Column: 68

                      c_other.set_key(1)
        if self.ignore == False and self.after_ts == True:
            # Make sure we get the expected prepare conflict message.
            self.assertRaisesException(wiredtiger.WiredTigerError, lambda:c_other.search(), preparemsg)
        else:
            c_other.search()
            self.assertTrue(c_other.get_value() == 1)

        c_other.set_value(3)

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 118 Column: 64

                      c_other.set_value(3)

        # Make sure we detect the conflict between operations.
        self.assertRaisesException(wiredtiger.WiredTigerError, lambda:c_other.update(), conflictmsg)
        s_other.rollback_transaction()

        self.session.timestamp_transaction('commit_timestamp=' + timestamp_str(300))
        self.session.timestamp_transaction('durable_timestamp=' + timestamp_str(300))
        self.session.commit_transaction()

            

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

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

def timestamp_str(t):
    return '%x' % t


            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 35 Column: 1

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

def timestamp_str(t):
    return '%x' % t


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 38 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

def timestamp_str(t):
    return '%x' % t

class test_prepare04(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare_cursor'
    uri = 'table:' + tablename

            

Reported by Pylint.

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

Line: 38 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

def timestamp_str(t):
    return '%x' % t

class test_prepare04(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare_cursor'
    uri = 'table:' + tablename

            

Reported by Pylint.

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

Line: 41 Column: 1

              def timestamp_str(t):
    return '%x' % t

class test_prepare04(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare_cursor'
    uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    before_ts = timestamp_str(150)

            

Reported by Pylint.

Missing class docstring
Error

Line: 41 Column: 1

              def timestamp_str(t):
    return '%x' % t

class test_prepare04(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare_cursor'
    uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    before_ts = timestamp_str(150)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_bug018.py
17 issues
Unable to import 'wiredtiger'
Error

Line: 32 Column: 1

              from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os
import wiredtiger, wttest

# test_bug018.py
#   JIRA WT-3590: if writing table data fails during close then tables
# that were updated within the same transaction could get out of sync with
# each other.

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 60 Column: 9

              
    def open_files(self):
        numfiles = 6
        dir = self.conn.get_home()
        for i in range(1, numfiles):
            fname = dir + '/file.' + str(i)
            self.flist.append(open(fname, 'w'))

    def create_table(self, uri):

            

Reported by Pylint.

Unused variable 'ignore_result'
Error

Line: 117 Column: 10

              
        self.close_conn()
        subdir = 'SUBPROCESS'
        [ignore_result, new_home_dir] = self.run_subprocess_function(subdir,
            'test_bug018.test_bug018.subprocess_bug018')

        # Make a backup for forensics in case something goes wrong.
        backup_dir = 'BACKUP'
        copy_wiredtiger_home(self, new_home_dir, backup_dir, True)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 138 Column: 9

                      self.captureerr.check(self)     # check there is no error output so far
        try:
            results2 = list(self.session.open_cursor(self.uri2))
        except:
            # Make sure there's some error, but we don't care what.
            self.captureerr.checkAdditionalPattern(self, '.')
            results2 = []
        self.assertEqual(results1, results2)


            

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.

standard import "import os" should be placed before "from helper import copy_wiredtiger_home"
Error

Line: 31 Column: 1

              
from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os
import wiredtiger, wttest

# test_bug018.py
#   JIRA WT-3590: if writing table data fails during close then tables
# that were updated within the same transaction could get out of sync with

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 32 Column: 1

              from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os
import wiredtiger, wttest

# test_bug018.py
#   JIRA WT-3590: if writing table data fails during close then tables
# that were updated within the same transaction could get out of sync with
# each other.

            

Reported by Pylint.

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

Line: 32 Column: 1

              from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os
import wiredtiger, wttest

# test_bug018.py
#   JIRA WT-3590: if writing table data fails during close then tables
# that were updated within the same transaction could get out of sync with
# each other.

            

Reported by Pylint.

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

Line: 38 Column: 1

              #   JIRA WT-3590: if writing table data fails during close then tables
# that were updated within the same transaction could get out of sync with
# each other.
class test_bug018(wttest.WiredTigerTestCase, suite_subprocess):
    '''Test closing/reopening/recovering tables when writes fail'''

    conn_config = 'log=(enabled)'
    basename = 'bug018.'
    baseuri = 'file:' + basename

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 52 Column: 9

                      # This test uses Linux-specific code so skip on any other system.
        if os.name != 'posix' or os.uname()[0] != 'Linux':
            self.skipTest('Linux-specific test skipped on ' + os.name)
        super(test_bug018, self).setUp()

    def close_files(self):
        for f in self.flist:
            f.close()


            

Reported by Pylint.

src/third_party/abseil-cpp-master/abseil-cpp/absl/numeric/int128_benchmark.cc
17 issues
random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

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

                std::uniform_int_distribution<H> uniform_h;
  values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    T b{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    values.emplace_back(std::max(a, b), std::max(T(2), std::min(a, b)));
  }
  return values;
}

            

Reported by FlawFinder.

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

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

                std::uniform_int_distribution<H> uniform_h;
  values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    T b{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    values.emplace_back(std::max(a, b), std::max(T(2), std::min(a, b)));
  }
  return values;
}

            

Reported by FlawFinder.

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

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

                values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    T b{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    values.emplace_back(std::max(a, b), std::max(T(2), std::min(a, b)));
  }
  return values;
}


            

Reported by FlawFinder.

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

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

                values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    T b{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    values.emplace_back(std::max(a, b), std::max(T(2), std::min(a, b)));
  }
  return values;
}


            

Reported by FlawFinder.

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

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

                std::uniform_int_distribution<H> uniform_h;
  values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    H b{std::max(H{2}, uniform_h(random))};
    values.emplace_back(std::max(a, T(b)), b);
  }
  return values;
}

            

Reported by FlawFinder.

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

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

                std::uniform_int_distribution<H> uniform_h;
  values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    H b{std::max(H{2}, uniform_h(random))};
    values.emplace_back(std::max(a, T(b)), b);
  }
  return values;
}

            

Reported by FlawFinder.

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

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

                values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    T a{absl::MakeUint128(uniform_h(random), uniform_h(random))};
    H b{std::max(H{2}, uniform_h(random))};
    values.emplace_back(std::max(a, T(b)), b);
  }
  return values;
}


            

Reported by FlawFinder.

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

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

                values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    values.emplace_back(
        absl::MakeUint128(uniform_uint64(random), uniform_uint64(random)),
        absl::MakeUint128(uniform_uint64(random), uniform_uint64(random)));
  }
  return values;
}


            

Reported by FlawFinder.

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

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

                values.reserve(kSampleSize);
  for (size_t i = 0; i < kSampleSize; ++i) {
    values.emplace_back(
        absl::MakeUint128(uniform_uint64(random), uniform_uint64(random)),
        absl::MakeUint128(uniform_uint64(random), uniform_uint64(random)));
  }
  return values;
}


            

Reported by FlawFinder.

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

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

                for (size_t i = 0; i < kSampleSize; ++i) {
    values.emplace_back(
        absl::MakeUint128(uniform_uint64(random), uniform_uint64(random)),
        absl::MakeUint128(uniform_uint64(random), uniform_uint64(random)));
  }
  return values;
}

void BM_MultiplyClass128(benchmark::State& state) {

            

Reported by FlawFinder.

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

Line: 88 Column: 5

              
    env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes)

    from . import pdf
    pdf.generate(env)

    bld = env['BUILDERS']['PDF']
    bld.add_action('.tex', PDFTeXLaTeXAction)
    bld.add_emitter('.tex', SCons.Tool.tex.tex_pdf_emitter)

            

Reported by Pylint.

Using the global statement
Error

Line: 73 Column: 5

              
def generate(env):
    """Add Builders and construction variables for pdftex to an Environment."""
    global PDFTeXAction
    if PDFTeXAction is None:
        PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR')

    global PDFLaTeXAction
    if PDFLaTeXAction is None:

            

Reported by Pylint.

Using the global statement
Error

Line: 77 Column: 5

                  if PDFTeXAction is None:
        PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR')

    global PDFLaTeXAction
    if PDFLaTeXAction is None:
        PDFLaTeXAction = SCons.Action.Action("$PDFLATEXCOM", "$PDFLATEXCOMSTR")

    global PDFTeXLaTeXAction
    if PDFTeXLaTeXAction is None:

            

Reported by Pylint.

Using the global statement
Error

Line: 81 Column: 5

                  if PDFLaTeXAction is None:
        PDFLaTeXAction = SCons.Action.Action("$PDFLATEXCOM", "$PDFLATEXCOMSTR")

    global PDFTeXLaTeXAction
    if PDFTeXLaTeXAction is None:
        PDFTeXLaTeXAction = SCons.Action.Action(PDFTeXLaTeXFunction,
                              strfunction=SCons.Tool.tex.TeXLaTeXStrFunction)

    env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes)

            

Reported by Pylint.

Line too long (117/100)
Error

Line: 35 Column: 1

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

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

import os
import SCons.Action
import SCons.Util
import SCons.Tool.tex

            

Reported by Pylint.

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

Line: 42 Column: 1

              import SCons.Util
import SCons.Tool.tex

PDFTeXAction = None

# This action might be needed more than once if we are dealing with
# labels and bibtex.
PDFLaTeXAction = None


            

Reported by Pylint.

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

Line: 46 Column: 1

              
# This action might be needed more than once if we are dealing with
# labels and bibtex.
PDFLaTeXAction = None

def PDFLaTeXAuxAction(target = None, source= None, env=None):
    result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env )
    return result


            

Reported by Pylint.

Function name "PDFLaTeXAuxAction" doesn't conform to snake_case naming style
Error

Line: 48 Column: 1

              # labels and bibtex.
PDFLaTeXAction = None

def PDFLaTeXAuxAction(target = None, source= None, env=None):
    result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env )
    return result

def PDFTeXLaTeXFunction(target = None, source= None, env=None):
    """A builder for TeX and LaTeX that scans the source file to

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 1

              # labels and bibtex.
PDFLaTeXAction = None

def PDFLaTeXAuxAction(target = None, source= None, env=None):
    result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env )
    return result

def PDFTeXLaTeXFunction(target = None, source= None, env=None):
    """A builder for TeX and LaTeX that scans the source file to

            

Reported by Pylint.

Function name "PDFTeXLaTeXFunction" doesn't conform to snake_case naming style
Error

Line: 52 Column: 1

                  result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env )
    return result

def PDFTeXLaTeXFunction(target = None, source= None, env=None):
    """A builder for TeX and LaTeX that scans the source file to
    decide the "flavor" of the source and then executes the appropriate
    program."""
    basedir = os.path.split(str(source[0]))[0]
    abspath = os.path.abspath(basedir)

            

Reported by Pylint.

src/third_party/boost/boost/phoenix/stl/algorithm/querying.hpp
17 issues
equal - Function does not check the second iterator for over-read conditions
Security

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

                          }
        };

        struct equal
        {
            typedef bool result_type;

            template<class R, class I>
            bool operator()(R& r, I i) const

            

Reported by FlawFinder.

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

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

                          template<class R, class I>
            bool operator()(R& r, I i) const
            {
                return std::equal(detail::begin_(r), detail::end_(r), i);
            }

            template<class R, class I, class P>
            bool operator()(R& r, I i, P p) const
            {

            

Reported by FlawFinder.

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

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

                      namespace result_of
        {
            template <typename R, typename I, typename P = void>
            struct mismatch
            {
                typedef std::pair<
                    typename range_iterator<R>::type
                    , typename detail::decay_array<I>::type
                > type;

            

Reported by FlawFinder.

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

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

                          };
        }

        struct mismatch
        {
            template <typename Sig>
            struct result;

            template<typename This, class R, class I>

            

Reported by FlawFinder.

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

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

              
            template<typename This, class R, class I>
            struct result<This(R&, I)>
                : result_of::mismatch<R, I>
            {};

            template<typename This, class R, class I, class P>
            struct result<This(R&, I, P)>
                : result_of::mismatch<R, I, P>

            

Reported by FlawFinder.

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

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

              
            template<typename This, class R, class I, class P>
            struct result<This(R&, I, P)>
                : result_of::mismatch<R, I, P>
            {};

            template<class R, class I>
            typename result_of::mismatch<R, I>::type
            operator()(R& r, I i) const

            

Reported by FlawFinder.

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

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

                          {};

            template<class R, class I>
            typename result_of::mismatch<R, I>::type
            operator()(R& r, I i) const
            {
                return std::mismatch(detail::begin_(r), detail::end_(r), i);
            }


            

Reported by FlawFinder.

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

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

                          typename result_of::mismatch<R, I>::type
            operator()(R& r, I i) const
            {
                return std::mismatch(detail::begin_(r), detail::end_(r), i);
            }

            template<class R, class I, class P>
            typename result_of::mismatch<R, I, P>::type
            operator()(R& r, I i, P p) const

            

Reported by FlawFinder.

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

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

                          }

            template<class R, class I, class P>
            typename result_of::mismatch<R, I, P>::type
            operator()(R& r, I i, P p) const
            {
                return std::mismatch(detail::begin_(r), detail::end_(r), i, p);
            }
        };

            

Reported by FlawFinder.

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

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

                  BOOST_PHOENIX_ADAPT_CALLABLE(count, impl::count, 2)
    BOOST_PHOENIX_ADAPT_CALLABLE(count_if, impl::count_if, 2)
    BOOST_PHOENIX_ADAPT_CALLABLE(distance, impl::distance, 1)
    BOOST_PHOENIX_ADAPT_CALLABLE(equal, impl::equal, 2)
    BOOST_PHOENIX_ADAPT_CALLABLE(equal, impl::equal, 3)
    BOOST_PHOENIX_ADAPT_CALLABLE(search, impl::search, 2)
    BOOST_PHOENIX_ADAPT_CALLABLE(search, impl::search, 3)
    BOOST_PHOENIX_ADAPT_CALLABLE(lower_bound, impl::lower_bound, 2)
    BOOST_PHOENIX_ADAPT_CALLABLE(lower_bound, impl::lower_bound, 3)

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_bug016.py
17 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

# test_bug016.py
#       WT-2757: WT_CURSOR.get_key() fails after WT_CURSOR.insert unless the
# cursor has a record number key with append configured.
class test_bug016(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 44 Column: 9

                      cursor = self.session.open_cursor(uri, None, 'append')
        cursor.set_value('value')
        cursor.insert()
        self.assertEquals(cursor.get_key(), 1)

    # Insert a row into a simple column-store table.
    # WT_CURSOR.get_key should fail.
    def test_simple_column_store(self):
        uri='file:bug016'

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 56 Column: 13

                      cursor.set_value('value')
        cursor.insert()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.get_key(), "/requires key be set/")

    # Insert a row into a simple row-store table.
    # WT_CURSOR.get_key should fail.
    def test_simple_row_store(self):
        uri='file:bug016'

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 68 Column: 13

                      cursor.set_value('value')
        cursor.insert()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.get_key(), "/requires key be set/")

    # Insert a row into a complex column-store table configured to append.
    # WT_CURSOR.get_key should succeed.
    def test_complex_column_store_append(self):
        uri='table:bug016'

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 79 Column: 9

                      cursor = self.session.open_cursor(uri, None, 'append')
        cursor.set_value('value')
        cursor.insert()
        self.assertEquals(cursor.get_key(), 1)

    # Insert a row into a complex column-store table.
    # WT_CURSOR.get_key should fail.
    def test_complex_column_store(self):
        uri='table:bug016'

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 92 Column: 13

                      cursor.set_value('value')
        cursor.insert()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.get_key(), "/requires key be set/")

    # Insert a row into a complex row-store table.
    # WT_CURSOR.get_key should fail.
    def test_complex_row_store(self):
        uri='table:bug016'

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 105 Column: 13

                      cursor.set_value('value')
        cursor.insert()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.get_key(), "/requires key be set/")

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

# test_bug016.py
#       WT-2757: WT_CURSOR.get_key() fails after WT_CURSOR.insert unless the
# cursor has a record number key with append configured.
class test_bug016(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              # test_bug016.py
#       WT-2757: WT_CURSOR.get_key() fails after WT_CURSOR.insert unless the
# cursor has a record number key with append configured.
class test_bug016(wttest.WiredTigerTestCase):

    # Insert a row into a simple column-store table configured to append.
    # WT_CURSOR.get_key should succeed.
    def test_simple_column_store_append(self):
        uri='file:bug016'

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_log03.py
17 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, shutil
import helper, wiredtiger, wttest
from wiredtiger import stat

# test_log03.py
#    test configuration for log.dirty_max
class test_log03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import os, shutil
import helper, wiredtiger, wttest
from wiredtiger import stat

# test_log03.py
#    test configuration for log.dirty_max
class test_log03(wttest.WiredTigerTestCase):
    """

            

Reported by Pylint.

Unused import helper
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, shutil
import helper, wiredtiger, wttest
from wiredtiger import stat

# test_log03.py
#    test configuration for log.dirty_max
class test_log03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, shutil
import helper, wiredtiger, wttest
from wiredtiger import stat

# test_log03.py
#    test configuration for log.dirty_max
class test_log03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 45 Column: 35

                  nentries = 20000

    # Tests need to setup the connection in their own way.
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

Unused argument 'dir'
Error

Line: 45 Column: 35

                  nentries = 20000

    # Tests need to setup the connection in their own way.
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

Parameters differ from overridden 'setUpConnectionOpen' method
Error

Line: 45 Column: 5

                  nentries = 20000

    # Tests need to setup the connection in their own way.
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

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 (os, shutil)
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 os, shutil
import helper, wiredtiger, wttest
from wiredtiger import stat

# test_log03.py
#    test configuration for log.dirty_max

            

Reported by Pylint.

Multiple imports on one line (helper, wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, shutil
import helper, wiredtiger, wttest
from wiredtiger import stat

# test_log03.py
#    test configuration for log.dirty_max
class test_log03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

src/mongo/db/exec/sbe/values/value.h
17 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

                  }

    Value val{0};
    memcpy(&val, &in, sizeof(T));
    return val;
}

template <typename T>
T bitcastTo(const Value in) noexcept {  // NOLINT(readability-avoid-const-params-in-decls)

            

Reported by FlawFinder.

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

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

                  } else {
        static_assert(sizeof(Value) >= sizeof(T));
        T val;
        memcpy(&val, &in, sizeof(T));
        return val;
    }
}

/**

            

Reported by FlawFinder.

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

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

              
    Value smallString{0};
    auto buf = getRawStringView(TypeTags::StringSmall, smallString);
    memcpy(buf, input.rawData(), input.size());
    return {TypeTags::StringSmall, smallString};
}

inline std::pair<TypeTags, Value> makeBigString(StringData input) {
    auto len = input.size();

            

Reported by FlawFinder.

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

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

                  auto length = static_cast<uint32_t>(len);
    auto buf = new char[length + 5];
    DataView(buf).write<LittleEndian<int32_t>>(length + 1);
    memcpy(buf + 4, ptr, length);
    buf[length + 4] = 0;
    return {TypeTags::StringBig, reinterpret_cast<Value>(buf)};
}

inline std::pair<TypeTags, Value> makeNewString(StringData input) {

            

Reported by FlawFinder.

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

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

                          // Owned BSON memory is managed through a UniqueBuffer for compatibility
            // with the BSONObj/BSONArray class.
            auto buffer = UniqueBuffer::allocate(size);
            memcpy(buffer.get(), bson, size);
            return {tag, reinterpret_cast<Value>(buffer.release())};
        }
        case TypeTags::bsonObjectId: {
            auto bson = getRawPointerView(val);
            auto size = sizeof(ObjectIdType);

            

Reported by FlawFinder.

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

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

                          auto bson = getRawPointerView(val);
            auto size = sizeof(ObjectIdType);
            auto dst = new uint8_t[size];
            memcpy(dst, bson, size);
            return {TypeTags::bsonObjectId, reinterpret_cast<Value>(dst)};
        }
        case TypeTags::bsonBinData: {
            auto binData = getRawPointerView(val);
            auto size = getBSONBinDataSize(tag, val);

            

Reported by FlawFinder.

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

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

                          auto binData = getRawPointerView(val);
            auto size = getBSONBinDataSize(tag, val);
            auto dst = new uint8_t[size + sizeof(uint32_t) + 1];
            memcpy(dst, binData, size + sizeof(uint32_t) + 1);
            return {TypeTags::bsonBinData, reinterpret_cast<Value>(dst)};
        }
        case TypeTags::ksValue:
            return makeCopyKeyString(*getKeyStringView(val));
        case TypeTags::pcreRegex:

            

Reported by FlawFinder.

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

Line: 302 Column: 25 CWE codes: 120 20

              }

inline Decimal128 readDecimal128FromMemory(const ConstDataView& view) {
    uint64_t low = view.read<LittleEndian<uint64_t>>();
    uint64_t high = view.read<LittleEndian<uint64_t>>(sizeof(uint64_t));
    return Decimal128{Decimal128::Value{low, high}};
}

template <class T>

            

Reported by FlawFinder.

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

Line: 303 Column: 26 CWE codes: 120 20

              
inline Decimal128 readDecimal128FromMemory(const ConstDataView& view) {
    uint64_t low = view.read<LittleEndian<uint64_t>>();
    uint64_t high = view.read<LittleEndian<uint64_t>>(sizeof(uint64_t));
    return Decimal128{Decimal128::Value{low, high}};
}

template <class T>
struct dont_deduce_t {

            

Reported by FlawFinder.

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

Line: 769 Column: 54 CWE codes: 120 20

                      }
#endif
    } else if (tag == TypeTags::StringBig || tag == TypeTags::bsonString) {
        return ConstDataView(getRawPointerView(val)).read<LittleEndian<int32_t>>() - 1;
    }
    MONGO_UNREACHABLE;
}

/**

            

Reported by FlawFinder.

src/third_party/gperftools/dist/src/tests/heap-checker_unittest.cc
17 issues
Return value of allocation function 'malloc' is not stored.
Error

Line: 686 CWE codes: 771

                HeapLeakChecker::Disabler disabler;
  AllocHidden(3 * sizeof(int));
  TransLeaks();
  (void)malloc(10);  // Direct leak
}

// have different disabled leaks
static void* RunDisabledLeaks(void* a) {
  ScopedDisabledLeaks();

            

Reported by Cppcheck.

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

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

                    *ptr = new(initialized) int[1];
    }
    set<int>* s2 = new(initialized) set<int>[1];
    s1.insert(random());
    s2->insert(*s1.begin());
    user += *s2->begin();
    **ptr += user;
    if (random() % 51 == 0) {
      s1.clear();

            

Reported by FlawFinder.

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

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

                  s2->insert(*s1.begin());
    user += *s2->begin();
    **ptr += user;
    if (random() % 51 == 0) {
      s1.clear();
      if (random() % 2 == 0) {
        s1.~Set();
        new(&s1) Set;
      }

            

Reported by FlawFinder.

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

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

                  **ptr += user;
    if (random() % 51 == 0) {
      s1.clear();
      if (random() % 2 == 0) {
        s1.~Set();
        new(&s1) Set;
      }
    }
    VLOG(3) << pthread_self() << " (" << getpid() << "): in wait: "

            

Reported by FlawFinder.

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

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

                    ptr = reinterpret_cast<int **>(
          reinterpret_cast<uintptr_t>(ptr) ^ kHideMask);
    } else {
      poll(NULL, 0, random() % 100);
    }
    VLOG(2) << pthread_self() << ": continuing";
    if (random() % 3 == 0) {
      delete [] *ptr;
      delete [] ptr;

            

Reported by FlawFinder.

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

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

                    poll(NULL, 0, random() % 100);
    }
    VLOG(2) << pthread_self() << ": continuing";
    if (random() % 3 == 0) {
      delete [] *ptr;
      delete [] ptr;
      ptr = NULL;
    }
    delete [] s2;

            

Reported by FlawFinder.

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

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

              template<class T>
struct Array {
  Array() {
    size = 3 + random() % 30;
    ptr = new(initialized) T[size];
  }
  ~Array() { delete [] ptr; }
  Array(const Array& x) {
    size = x.size;

            

Reported by FlawFinder.

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

Line: 1112 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              class ClassB {
 public:
  ClassB() { }
  char b[7];
  virtual void f() { }
  virtual ~ClassB() { }
};

class ClassB2 {

            

Reported by FlawFinder.

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

Line: 1120 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              class ClassB2 {
 public:
  ClassB2() { }
  char b2[11];
  virtual void f2() { }
  virtual ~ClassB2() { }
};

class ClassD1 : public ClassB {

            

Reported by FlawFinder.

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

Line: 1126 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              };

class ClassD1 : public ClassB {
  char d1[15];
  virtual void f() { }
};

class ClassD2 : public ClassB2 {
  char d2[19];

            

Reported by FlawFinder.