The following issues were found

src/third_party/mozjs-60/extract/js/src/builtin/DataViewObject.cpp
11 issues
There is an unknown macro here somewhere. Configuration is required. If JS_FRIEND_API is a macro then please configure it.
Error

Line: 982

                  setPrivate(newData);
}

JS_FRIEND_API(bool)
JS_IsDataViewObject(JSObject* obj)
{
    obj = CheckedUnwrap(obj);
    return obj ? obj->is<DataViewObject>() : false;
}

            

Reported by Cppcheck.

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

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

              static inline void
Memcpy(uint8_t* dest, uint8_t* src, size_t nbytes)
{
    memcpy(dest, src, nbytes);
}

static inline void
Memcpy(uint8_t* dest, SharedMem<uint8_t*> src, size_t nbytes)
{

            

Reported by FlawFinder.

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

Line: 385 Column: 17 CWE codes: 120 20

              
template<typename NativeType>
/* static */ bool
DataViewObject::read(JSContext* cx, Handle<DataViewObject*> obj, const CallArgs& args,
                     NativeType* val)
{
    // Steps 1-2. done by the caller
    // Step 3. unnecessary assert


            

Reported by FlawFinder.

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

Line: 513 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    int8_t val;
    if (!read(cx, thisView, args, &val))
        return false;
    args.rval().setInt32(val);
    return true;
}


            

Reported by FlawFinder.

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

Line: 534 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    uint8_t val;
    if (!read(cx, thisView, args, &val))
        return false;
    args.rval().setInt32(val);
    return true;
}


            

Reported by FlawFinder.

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

Line: 555 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    int16_t val;
    if (!read(cx, thisView, args, &val))
        return false;
    args.rval().setInt32(val);
    return true;
}


            

Reported by FlawFinder.

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

Line: 576 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    uint16_t val;
    if (!read(cx, thisView, args, &val))
        return false;
    args.rval().setInt32(val);
    return true;
}


            

Reported by FlawFinder.

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

Line: 597 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    int32_t val;
    if (!read(cx, thisView, args, &val))
        return false;
    args.rval().setInt32(val);
    return true;
}


            

Reported by FlawFinder.

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

Line: 618 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    uint32_t val;
    if (!read(cx, thisView, args, &val))
        return false;
    args.rval().setNumber(val);
    return true;
}


            

Reported by FlawFinder.

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

Line: 639 Column: 10 CWE codes: 120 20

                  Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());

    float val;
    if (!read(cx, thisView, args, &val))
        return false;

    args.rval().setDouble(CanonicalizeNaN(val));
    return true;
}

            

Reported by FlawFinder.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Scanner/Prog.py
11 issues
Unused argument 'node'
Error

Line: 59 Column: 10

                      libs = [libs]
    return libs

def scan(node, env, libpath = ()):
    """
    This scanner scans program files for static-library
    dependencies.  It will search the LIBPATH environment variable
    for libraries specified in the LIBS variable, returning any
    files it finds as dependencies.

            

Reported by Pylint.

Module name "Prog" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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

            

Reported by Pylint.

Line too long (118/100)
Error

Line: 24 Column: 1

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

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

import SCons.Node
import SCons.Node.FS
import SCons.Scanner
import SCons.Util

            

Reported by Pylint.

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

Line: 32 Column: 1

              import SCons.Util

# global, set by --debug=findlibs
print_find_libs = None

def ProgramScanner(**kw):
    """Return a prototype Scanner instance for scanning executable
    files for static-lib dependencies"""
    kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH')

            

Reported by Pylint.

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

Line: 34 Column: 1

              # global, set by --debug=findlibs
print_find_libs = None

def ProgramScanner(**kw):
    """Return a prototype Scanner instance for scanning executable
    files for static-lib dependencies"""
    kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH')
    ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw)
    return ps

            

Reported by Pylint.

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

Line: 38 Column: 5

                  """Return a prototype Scanner instance for scanning executable
    files for static-lib dependencies"""
    kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH')
    ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw)
    return ps

def _subst_libs(env, libs):
    """
    Substitute environment variables and split into list.

            

Reported by Pylint.

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

Line: 51 Column: 13

                          libs = libs.split()
    elif SCons.Util.is_Sequence(libs):
        _libs = []
        for l in libs:
            _libs += _subst_libs(env, l)
        libs = _libs
    else:
        # libs is an object (Node, for example)
        libs = [libs]

            

Reported by Pylint.

Too many branches (13/12)
Error

Line: 59 Column: 1

                      libs = [libs]
    return libs

def scan(node, env, libpath = ()):
    """
    This scanner scans program files for static-library
    dependencies.  It will search the LIBPATH environment variable
    for libraries specified in the LIBS variable, returning any
    files it finds as dependencies.

            

Reported by Pylint.

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

Line: 103 Column: 17

                  for lib in libs:
        if SCons.Util.is_String(lib):
            for pref, suf in pairs:
                l = adjustixes(lib, pref, suf)
                l = find_file(l, libpath, verbose=print_find_libs)
                if l:
                    result.append(l)
        else:
            result.append(lib)

            

Reported by Pylint.

src/third_party/icu4c-57.1/source/common/unames.cpp
11 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 125 Column: 14 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

              
#define U_CHAR_EXTENDED_CATEGORY_COUNT (U_CHAR_CATEGORY_COUNT + 3)

static const char * const charCatNames[U_CHAR_EXTENDED_CATEGORY_COUNT] = {
    "unassigned",
    "uppercase letter",
    "lowercase letter",
    "titlecase letter",
    "modifier letter",

            

Reported by FlawFinder.

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

Line: 606 Column: 9 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

              
    s=expandGroupLengths(s, offsets, lengths);
    if(fn!=DO_FIND_NAME) {
        char buffer[200];
        uint16_t length;

        while(start<=end) {
            length=expandName(names, s+offsets[start&GROUP_MASK], lengths[start&GROUP_MASK], nameChoice, buffer, sizeof(buffer));
            if (!length && nameChoice == U_EXTENDED_CHAR_NAME) {

            

Reported by FlawFinder.

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

Line: 646 Column: 9 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

                           UEnumCharNamesFn *fn, void *context)
{
    if(fn!=DO_FIND_NAME) {
        char buffer[200];
        uint16_t length;
        
        while(start<=end) {
            buffer[length = getExtName(start, buffer, sizeof(buffer))] = 0;
            /* here, we assume that the buffer is large enough */

            

Reported by FlawFinder.

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

Line: 775 Column: 25 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

                                const char *s, /* suffix elements */
                  uint32_t code,
                  uint16_t indexes[8], /* output fields from here */
                  const char *elementBases[8], const char *elements[8],
                  char *buffer, uint16_t bufferLength) {
    uint16_t i, factor, bufferPos=0;
    char c;

    /* write elements according to the factors */

            

Reported by FlawFinder.

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

Line: 775 Column: 54 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

                                const char *s, /* suffix elements */
                  uint32_t code,
                  uint16_t indexes[8], /* output fields from here */
                  const char *elementBases[8], const char *elements[8],
                  char *buffer, uint16_t bufferLength) {
    uint16_t i, factor, bufferPos=0;
    char c;

    /* write elements according to the factors */

            

Reported by FlawFinder.

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

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

                           UChar32 start, UChar32 limit,
             UEnumCharNamesFn *fn, void *context,
             UCharNameChoice nameChoice) {
    char buffer[200];
    uint16_t length;

    if(nameChoice!=U_UNICODE_CHAR_NAME && nameChoice!=U_EXTENDED_CHAR_NAME) {
        return TRUE;
    }

            

Reported by FlawFinder.

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

Line: 992 Column: 15 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

                  }
    case 1: {
        uint16_t indexes[8];
        const char *elementBases[8], *elements[8];
        const uint16_t *factors=(const uint16_t *)(range+1);
        uint16_t count=range->variant;
        const char *s=(const char *)(factors+count);
        char *suffix, *t;
        uint16_t prefixLength, i, idx;

            

Reported by FlawFinder.

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

Line: 1119 Column: 9 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

                      break;
    }
    case 1: {
        char buffer[64];
        uint16_t indexes[8];
        const char *elementBases[8], *elements[8];
        const uint16_t *factors=(const uint16_t *)(range+1);
        uint16_t count=range->variant;
        const char *s=(const char *)(factors+count), *t;

            

Reported by FlawFinder.

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

Line: 1121 Column: 15 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

                  case 1: {
        char buffer[64];
        uint16_t indexes[8];
        const char *elementBases[8], *elements[8];
        const uint16_t *factors=(const uint16_t *)(range+1);
        uint16_t count=range->variant;
        const char *s=(const char *)(factors+count), *t;
        UChar32 start, limit;
        uint16_t i, idx;

            

Reported by FlawFinder.

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

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

              u_charFromName(UCharNameChoice nameChoice,
               const char *name,
               UErrorCode *pErrorCode) {
    char upper[120], lower[120];
    FindName findName;
    AlgorithmicRange *algRange;
    uint32_t *p;
    uint32_t i;
    UChar32 cp = 0;

            

Reported by FlawFinder.

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

Line: 34 Column: 1

              #   continue to generate more log files.
#

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

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

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (fnmatch, os, shutil, time)
Error

Line: 34 Column: 1

              #   continue to generate more log files.
#

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

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

            

Reported by Pylint.

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

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wttest

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

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wttest

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

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 54 Column: 5

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

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

            

Reported by Pylint.

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

Line: 56 Column: 9

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

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 81 Column: 5

                      # close the original connection.
        self.close_conn()

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

            

Reported by Pylint.

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

Line: 102 Column: 25

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

            

Reported by Pylint.

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

Line: 104 Column: 25

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

            

Reported by Pylint.

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

Line: 29 Column: 1

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

import wiredtiger, wtscenario, wttest
from wtdataset import SimpleDataSet

# test_lsm01.py
#    Test LSM tree configuration options.
class test_lsm01(wttest.WiredTigerTestCase):

            

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

# test_lsm01.py
#    Test LSM tree configuration options.
class test_lsm01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

TODO: Adding an explicit drop here can cause deadlocks, if a merge
Error

Line: 82 Column: 3

                          'Test LSM with config: ' + args + ' count: ' + str(self.nrecs))
        SimpleDataSet(self, self.uri, self.nrecs, config=args).populate()

        # TODO: Adding an explicit drop here can cause deadlocks, if a merge
        # is still happening. See issue #349.
        # self.session.drop(self.uri)

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

# test_lsm01.py
#    Test LSM tree configuration options.
class test_lsm01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_lsm01.py
#    Test LSM tree configuration options.
class test_lsm01(wttest.WiredTigerTestCase):
    K = 1024
    M = 1024 * K
    G = 1024 * M
    uri = "lsm:test_lsm01"


            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_lsm01.py
#    Test LSM tree configuration options.
class test_lsm01(wttest.WiredTigerTestCase):
    K = 1024
    M = 1024 * K
    G = 1024 * M
    uri = "lsm:test_lsm01"


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 63 Column: 5

                      prune=100, prunelong=500)

    # Test drop of an object.
    def test_lsm(self):
        args = 'key_format=S'
        args += ',lsm=(' # Start the LSM configuration options.
        # add names to args, e.g. args += ',session_max=30'
        for var in self.config_vars:
            value = getattr(self, 's_' + var)

            

Reported by Pylint.

Comparison 'value != None' should be 'value is not None'
Error

Line: 69 Column: 16

                      # add names to args, e.g. args += ',session_max=30'
        for var in self.config_vars:
            value = getattr(self, 's_' + var)
            if value != None:
                if var == 'verbose':
                    value = '[' + str(value) + ']'
                if value == True:
                    value = 'true'
                if value == False:

            

Reported by Pylint.

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

Line: 72 Column: 20

                          if value != None:
                if var == 'verbose':
                    value = '[' + str(value) + ']'
                if value == True:
                    value = 'true'
                if value == False:
                    value = 'false'
                args += ',' + var + '=' + str(value)
        args += ')' # Close the LSM configuration option group

            

Reported by Pylint.

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

Line: 36 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_txn17(wttest.WiredTigerTestCase, suite_subprocess):
    def test_txn_api(self):
        # Test API functionality tagged as requires_transaction.
        # Cannot set a timestamp on a non-running transaction.

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 49 Column: 13

              
        # Cannot call commit on a non-running transaction.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.commit_transaction(),
                '/only permitted in a running transaction/')

        # Cannot call rollback on a non-running transaction.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.rollback_transaction(),

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 54 Column: 13

              
        # Cannot call rollback on a non-running transaction.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.rollback_transaction(),
                '/only permitted in a running transaction/')

        # Cannot begin a transaction while a transaction is already running.
        self.session.begin_transaction()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 60 Column: 13

                      # Cannot begin a transaction while a transaction is already running.
        self.session.begin_transaction()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.begin_transaction(),
                '/not permitted in a running transaction/')
        self.session.rollback_transaction()

        # Cannot take a checkpoint while a transaction is running.
        self.session.begin_transaction()

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 67 Column: 13

                      # Cannot take a checkpoint while a transaction is running.
        self.session.begin_transaction()
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.checkpoint(),
                '/not permitted in a running transaction/')
        self.session.rollback_transaction()

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

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_txn17(wttest.WiredTigerTestCase, suite_subprocess):
    def test_txn_api(self):
        # Test API functionality tagged as requires_transaction.
        # Cannot set a timestamp on a non-running transaction.

            

Reported by Pylint.

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

Line: 36 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_txn17(wttest.WiredTigerTestCase, suite_subprocess):
    def test_txn_api(self):
        # Test API functionality tagged as requires_transaction.
        # Cannot set a timestamp on a non-running transaction.

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_txn17(wttest.WiredTigerTestCase, suite_subprocess):
    def test_txn_api(self):
        # Test API functionality tagged as requires_transaction.
        # Cannot set a timestamp on a non-running transaction.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.timestamp_transaction(

            

Reported by Pylint.

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

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_txn17(wttest.WiredTigerTestCase, suite_subprocess):
    def test_txn_api(self):
        # Test API functionality tagged as requires_transaction.
        # Cannot set a timestamp on a non-running transaction.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.timestamp_transaction(

            

Reported by Pylint.

src/mongo/base/data_range_test.cpp
11 issues
syntax error
Error

Line: 61

                  ASSERT_EQUALS(ErrorCodes::Overflow, result.getStatus().code());
}

TEST(DataRange, ConstDataRangeType) {
    char buf[] = "foo";

    ConstDataRange cdr(buf, buf + sizeof(buf));

    ConstDataRange out(nullptr, nullptr);

            

Reported by Cppcheck.

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

Line: 41 Column: 14 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

              namespace mongo {

TEST(DataRange, ConstDataRange) {
    unsigned char buf[sizeof(uint32_t) * 3];
    uint32_t native = 1234;
    uint32_t le = endian::nativeToLittle(native);
    uint32_t be = endian::nativeToBig(native);

    std::memcpy(buf, &native, sizeof(uint32_t));

            

Reported by FlawFinder.

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

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

                  uint32_t le = endian::nativeToLittle(native);
    uint32_t be = endian::nativeToBig(native);

    std::memcpy(buf, &native, sizeof(uint32_t));
    std::memcpy(buf + sizeof(uint32_t), &le, sizeof(uint32_t));
    std::memcpy(buf + sizeof(uint32_t) * 2, &be, sizeof(uint32_t));

    ConstDataRange cdv(buf, buf + sizeof(buf));


            

Reported by FlawFinder.

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

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

                  uint32_t be = endian::nativeToBig(native);

    std::memcpy(buf, &native, sizeof(uint32_t));
    std::memcpy(buf + sizeof(uint32_t), &le, sizeof(uint32_t));
    std::memcpy(buf + sizeof(uint32_t) * 2, &be, sizeof(uint32_t));

    ConstDataRange cdv(buf, buf + sizeof(buf));

    ASSERT_EQUALS(native, cdv.read<uint32_t>());

            

Reported by FlawFinder.

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

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

              
    std::memcpy(buf, &native, sizeof(uint32_t));
    std::memcpy(buf + sizeof(uint32_t), &le, sizeof(uint32_t));
    std::memcpy(buf + sizeof(uint32_t) * 2, &be, sizeof(uint32_t));

    ConstDataRange cdv(buf, buf + sizeof(buf));

    ASSERT_EQUALS(native, cdv.read<uint32_t>());
    ASSERT_EQUALS(native, cdv.read<LittleEndian<uint32_t>>(sizeof(uint32_t)));

            

Reported by FlawFinder.

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

Line: 52 Column: 31 CWE codes: 120 20

              
    ConstDataRange cdv(buf, buf + sizeof(buf));

    ASSERT_EQUALS(native, cdv.read<uint32_t>());
    ASSERT_EQUALS(native, cdv.read<LittleEndian<uint32_t>>(sizeof(uint32_t)));
    ASSERT_EQUALS(native, cdv.read<BigEndian<uint32_t>>(sizeof(uint32_t) * 2));

    auto result = cdv.readNoThrow<uint32_t>(sizeof(uint32_t) * 3);
    ASSERT_EQUALS(false, result.isOK());

            

Reported by FlawFinder.

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

Line: 53 Column: 31 CWE codes: 120 20

                  ConstDataRange cdv(buf, buf + sizeof(buf));

    ASSERT_EQUALS(native, cdv.read<uint32_t>());
    ASSERT_EQUALS(native, cdv.read<LittleEndian<uint32_t>>(sizeof(uint32_t)));
    ASSERT_EQUALS(native, cdv.read<BigEndian<uint32_t>>(sizeof(uint32_t) * 2));

    auto result = cdv.readNoThrow<uint32_t>(sizeof(uint32_t) * 3);
    ASSERT_EQUALS(false, result.isOK());
    ASSERT_EQUALS(ErrorCodes::Overflow, result.getStatus().code());

            

Reported by FlawFinder.

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

Line: 54 Column: 31 CWE codes: 120 20

              
    ASSERT_EQUALS(native, cdv.read<uint32_t>());
    ASSERT_EQUALS(native, cdv.read<LittleEndian<uint32_t>>(sizeof(uint32_t)));
    ASSERT_EQUALS(native, cdv.read<BigEndian<uint32_t>>(sizeof(uint32_t) * 2));

    auto result = cdv.readNoThrow<uint32_t>(sizeof(uint32_t) * 3);
    ASSERT_EQUALS(false, result.isOK());
    ASSERT_EQUALS(ErrorCodes::Overflow, result.getStatus().code());
}

            

Reported by FlawFinder.

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

Line: 88 Column: 30 CWE codes: 120 20

                  ASSERT_NOT_OK(result);
    ASSERT_EQUALS(ErrorCodes::Overflow, result.code());

    ASSERT_EQUALS(native, dv.read<uint32_t>());
    ASSERT_EQUALS(native, dv.read<LittleEndian<uint32_t>>(sizeof(uint32_t)));
    ASSERT_EQUALS(native, dv.read<BigEndian<uint32_t>>(sizeof(uint32_t) * 2));

    ASSERT_NOT_OK(dv.readNoThrow<uint32_t>(sizeof(uint32_t) * 3));
}

            

Reported by FlawFinder.

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

Line: 89 Column: 30 CWE codes: 120 20

                  ASSERT_EQUALS(ErrorCodes::Overflow, result.code());

    ASSERT_EQUALS(native, dv.read<uint32_t>());
    ASSERT_EQUALS(native, dv.read<LittleEndian<uint32_t>>(sizeof(uint32_t)));
    ASSERT_EQUALS(native, dv.read<BigEndian<uint32_t>>(sizeof(uint32_t) * 2));

    ASSERT_NOT_OK(dv.readNoThrow<uint32_t>(sizeof(uint32_t) * 3));
}


            

Reported by FlawFinder.

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

Line: 114 CWE codes: 908

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

            

Reported by Cppcheck.

Uninitialized variable: nat_bits
Error

Line: 116 CWE codes: 908

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

            

Reported by Cppcheck.

Uninitialized variable: psr
Error

Line: 153 CWE codes: 908

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

            

Reported by Cppcheck.

Uninitialized variable: ip
Error

Line: 174 CWE codes: 908

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

      case UNW_IA64_AR_BSPSTORE:

            

Reported by Cppcheck.

Uninitialized variable: psr
Error

Line: 174 CWE codes: 908

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

      case UNW_IA64_AR_BSPSTORE:

            

Reported by Cppcheck.

Uninitialized variable: cfm
Error

Line: 198 CWE codes: 908

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

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

            

Reported by Cppcheck.

Uninitialized variable: cfm
Error

Line: 243 CWE codes: 908

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

            

Reported by Cppcheck.

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

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

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

            

Reported by FlawFinder.

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

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

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

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

            

Reported by FlawFinder.

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

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

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

            

Reported by FlawFinder.

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

Line: 35 Column: 1

              #

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

class test_assert07(wttest.WiredTigerTestCase, suite_subprocess):
    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 35 Column: 1

              #

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

class test_assert07(wttest.WiredTigerTestCase, suite_subprocess):
    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 35 Column: 1

              #

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

class test_assert07(wttest.WiredTigerTestCase, suite_subprocess):
    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),

            

Reported by Pylint.

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

Line: 35 Column: 1

              #

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

class test_assert07(wttest.WiredTigerTestCase, suite_subprocess):
    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert07(wttest.WiredTigerTestCase, suite_subprocess):
    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),
        ('string-row', dict(key_format='S', usestrings=True))
    ]
    scenarios = make_scenarios(key_format_values)

            

Reported by Pylint.

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

Line: 38 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert07(wttest.WiredTigerTestCase, suite_subprocess):
    key_format_values = [
        ('column', dict(key_format='r', usestrings=False)),
        ('string-row', dict(key_format='S', usestrings=True))
    ]
    scenarios = make_scenarios(key_format_values)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 45 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def apply_timestamps(self, timestamp):
        self.session.prepare_transaction(
            'prepare_timestamp=' + self.timestamp_str(timestamp))
        self.session.timestamp_transaction(
            'commit_timestamp=' + self.timestamp_str(timestamp))
        self.session.timestamp_transaction(

            

Reported by Pylint.

Too many statements (63/50)
Error

Line: 53 Column: 5

                      self.session.timestamp_transaction(
            'durable_timestamp=' + self.timestamp_str(timestamp))

    def test_timestamp_alter(self):
        base = 'assert07'
        uri = 'file:' + base

        key_ts1 = 'key_ts1' if self.usestrings else 1


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 53 Column: 5

                      self.session.timestamp_transaction(
            'durable_timestamp=' + self.timestamp_str(timestamp))

    def test_timestamp_alter(self):
        base = 'assert07'
        uri = 'file:' + base

        key_ts1 = 'key_ts1' if self.usestrings else 1


            

Reported by Pylint.

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

Line: 33 Column: 1

              #   Transactions: commits and rollbacks
#

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

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Unused import os
Error

Line: 33 Column: 1

              #   Transactions: commits and rollbacks
#

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

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Unused import fnmatch
Error

Line: 33 Column: 1

              #   Transactions: commits and rollbacks
#

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

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Unused import shutil
Error

Line: 33 Column: 1

              #   Transactions: commits and rollbacks
#

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

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (fnmatch, os, shutil, time)
Error

Line: 33 Column: 1

              #   Transactions: commits and rollbacks
#

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

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

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

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wttest

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):
    t1 = 'table:test_txn10_1'
    t2 = 'table:test_txn10_2'
    create_params = 'key_format=i,value_format=i'
    conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
                'transaction_sync=(method=dsync,enabled)'

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wttest

class test_txn10(wttest.WiredTigerTestCase, suite_subprocess):
    t1 = 'table:test_txn10_1'
    t2 = 'table:test_txn10_2'
    create_params = 'key_format=i,value_format=i'
    conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
                'transaction_sync=(method=dsync,enabled)'

            

Reported by Pylint.

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

Line: 60 Column: 9

                      self.session.create(self.t1, self.create_params)
        self.reopen_conn()
        self.session.create(self.t2, self.create_params)
        c = self.session.open_cursor(self.t2, None, None)
        for i in range(10000):
            c[i] = i + 1
        c.close()
        simulate_crash_restart(self, ".", "RESTART")
        c = self.session.open_cursor(self.t2, None, None)

            

Reported by Pylint.

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

Line: 65 Column: 9

                          c[i] = i + 1
        c.close()
        simulate_crash_restart(self, ".", "RESTART")
        c = self.session.open_cursor(self.t2, None, None)
        i = 0
        for key, value in c:
            self.assertEqual(i, key)
            self.assertEqual(i+1, value)
            i += 1

            

Reported by Pylint.