The following issues were found

src/third_party/wiredtiger/test/suite/test_checkpoint08.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 36 Column: 1

              # test_checkpoint08.py
# Test that the btree checkpoint is not skipped if there are obsolete pages.

import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 37 Column: 1

              # Test that the btree checkpoint is not skipped if there are obsolete pages.

import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 36 Column: 1

              # test_checkpoint08.py
# Test that the btree checkpoint is not skipped if there are obsolete pages.

import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'

            

Reported by Pylint.

Unused SimpleDataSet imported from wtdataset
Error

Line: 38 Column: 1

              
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
    session_config = 'isolation=snapshot'


            

Reported by Pylint.

Attribute 'uri1' defined outside __init__
Error

Line: 52 Column: 9

                      return val

    def test_checkpoint08(self):
        self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')

            

Reported by Pylint.

Attribute 'file1' defined outside __init__
Error

Line: 53 Column: 9

              
    def test_checkpoint08(self):
        self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')

            

Reported by Pylint.

Attribute 'uri2' defined outside __init__
Error

Line: 54 Column: 9

                  def test_checkpoint08(self):
        self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')


            

Reported by Pylint.

Attribute 'file2' defined outside __init__
Error

Line: 55 Column: 9

                      self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')

        # Pin oldest and stable to timestamp 1.

            

Reported by Pylint.

Attribute 'hsfile' defined outside __init__
Error

Line: 56 Column: 9

                      self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')

        # Pin oldest and stable to timestamp 1.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(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.

src/third_party/wiredtiger/src/schema/schema_create.c
19 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 338 Column: 11 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

                  WT_TABLE *table;
    size_t tlen;
    char *cgconf, *origconf;
    const char **cfgp, *cfg[4] = {WT_CONFIG_BASE(session, colgroup_meta), config, NULL, NULL};
    const char *cgname, *source, *sourceconf, *tablename;
    const char *sourcecfg[] = {config, NULL, NULL};
    bool exists, tracked;

    sourceconf = NULL;

            

Reported by FlawFinder.

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

Line: 520 Column: 11 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

                  size_t tlen;
    u_int i, npublic_cols;
    char *idxconf, *origconf;
    const char *cfg[4] = {WT_CONFIG_BASE(session, index_meta), NULL, NULL, NULL};
    const char *source, *sourceconf, *idxname, *tablename;
    const char *sourcecfg[] = {config, NULL, NULL};
    bool exists, have_extractor;

    sourceconf = NULL;

            

Reported by FlawFinder.

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

Line: 703 Column: 11 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

                  size_t len;
    int ncolgroups, nkeys;
    char *cgcfg, *cgname, *filecfg, *filename, *importcfg, *tablecfg;
    const char *cfg[4] = {WT_CONFIG_BASE(session, table_meta), config, NULL, NULL};
    const char *tablename;
    bool import_repair;

    import_repair = false;


            

Reported by FlawFinder.

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

Line: 842 Column: 11 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

                  WT_DECL_RET;
    WT_TIERED *tiered;
    char *meta_value;
    const char *cfg[5] = {WT_CONFIG_BASE(session, tiered_meta), NULL, NULL, NULL, NULL};
    const char *metadata;

    conn = S2C(session);
    metadata = NULL;
    tiered = NULL;

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 293 Column: 37 CWE codes: 126

                  size_t len;
    const char *prefix, *suffix, *tablename;

    tablename = table->iface.name + strlen("table:");
    if ((ret = __wt_config_getones(session, config, "type", &cval)) == 0 &&
      !WT_STRING_MATCH("file", cval.str, cval.len)) {
        prefix = cval.str;
        len = cval.len;
        suffix = "";

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 307 Column: 15 CWE codes: 126

                       * off using tiered storage for this create. Otherwise the default prefix is tiered.
         */
        prefix = "file";
        len = strlen(prefix);
        suffix = ".wt";
    } else {
        prefix = "tiered";
        len = strlen(prefix);
        suffix = "";

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 311 Column: 15 CWE codes: 126

                      suffix = ".wt";
    } else {
        prefix = "tiered";
        len = strlen(prefix);
        suffix = "";
    }
    WT_RET_NOTFOUND_OK(ret);

    if (cgname == NULL)

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 357 Column: 16 CWE codes: 126

                      tlen = (size_t)(cgname - tablename);
        ++cgname;
    } else
        tlen = strlen(tablename);

    if ((ret = __wt_schema_get_table(
           session, tablename, tlen, true, WT_DHANDLE_EXCLUSIVE, &table)) != 0)
        WT_RET_MSG(session, (ret == WT_NOTFOUND) ? ENOENT : ret,
          "Can't create '%s' for non-existent table '%.*s'", name, (int)tlen, tablename);

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 445 Column: 37 CWE codes: 126

                  size_t len;
    const char *prefix, *suffix, *tablename;

    tablename = table->iface.name + strlen("table:");
    if ((ret = __wt_config_getones(session, config, "type", &cval)) == 0 &&
      !WT_STRING_MATCH("file", cval.str, cval.len)) {
        prefix = cval.str;
        len = cval.len;
        suffix = "_idx";

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 453 Column: 15 CWE codes: 126

                      suffix = "_idx";
    } else {
        prefix = "file";
        len = strlen(prefix);
        suffix = ".wti";
    }
    WT_RET_NOTFOUND_OK(ret);

    WT_RET(

            

Reported by FlawFinder.

src/third_party/mozjs-60/extract/js/src/jit/x86/Lowering-x86.cpp
19 issues
access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 295 Column: 14 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicLoadI64(useRegister(memoryBase),
                                                    useRegister(base),
                                                    tempFixed(ecx),
                                                    tempFixed(ebx));
        defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 295 Column: 55 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicLoadI64(useRegister(memoryBase),
                                                    useRegister(base),
                                                    tempFixed(ecx),
                                                    tempFixed(ebx));
        defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 310 Column: 73 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  // pointer to a register only if that can't happen.

    LAllocation baseAlloc;
    if (!base->isConstant() || !(base->toConstant()->isInt32(0) || ins->access().offset() == 0))
        baseAlloc = ins->type() == MIRType::Int64 ? useRegister(base) : useRegisterAtStart(base);

    if (ins->type() != MIRType::Int64) {
        auto* lir = new(alloc()) LWasmLoad(baseAlloc, useRegisterAtStart(memoryBase));
        define(lir, ins);

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 325 Column: 36 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              
    auto* lir = new(alloc()) LWasmLoadI64(baseAlloc, useRegister(memoryBase));

    Scalar::Type accessType = ins->access().type();
    if (accessType == Scalar::Int8 || accessType == Scalar::Int16 || accessType == Scalar::Int32) {
        // We use cdq to sign-extend the result and cdq demands these registers.
        defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),
                                                    LAllocation(AnyRegister(eax))));
        return;

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 345 Column: 55 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicStoreI64(useRegister(memoryBase),
                                                     useRegister(base),
                                                     useInt64Fixed(ins->value(),
                                                                   Register64(ecx, ebx)),
                                                     tempFixed(edx),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 345 Column: 14 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
        auto* lir = new(alloc()) LWasmAtomicStoreI64(useRegister(memoryBase),
                                                     useRegister(base),
                                                     useInt64Fixed(ins->value(),
                                                                   Register64(ecx, ebx)),
                                                     tempFixed(edx),

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 361 Column: 73 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  // pointer to a register only if that can't happen.

    LAllocation baseAlloc;
    if (!base->isConstant() || !(base->toConstant()->isInt32(0) || ins->access().offset() == 0))
        baseAlloc = useRegisterAtStart(base);

    LAllocation valueAlloc;
    switch (ins->access().type()) {
      case Scalar::Int8: case Scalar::Uint8:

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 365 Column: 18 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      baseAlloc = useRegisterAtStart(base);

    LAllocation valueAlloc;
    switch (ins->access().type()) {
      case Scalar::Int8: case Scalar::Uint8:
        // See comment for LIRGeneratorX86::useByteOpRegister.
        valueAlloc = useFixed(ins->value(), eax);
        break;
      case Scalar::Int16: case Scalar::Uint16:

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 444 Column: 18 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                                         : LAllocation();

    LAsmJSStoreHeap* lir = nullptr;
    switch (ins->access().type()) {
      case Scalar::Int8: case Scalar::Uint8:
        // See comment for LIRGeneratorX86::useByteOpRegister.
        lir = new(alloc()) LAsmJSStoreHeap(baseAlloc, useFixed(ins->value(), eax),
                                           limitAlloc, useRegisterAtStart(memoryBase));
        break;

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 480 Column: 14 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  MDefinition* memoryBase = ins->memoryBase();
    MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);

    if (ins->access().type() == Scalar::Int64) {
        auto* lir = new(alloc()) LWasmCompareExchangeI64(useRegister(memoryBase),
                                                         useRegister(base),
                                                         useInt64Fixed(ins->oldValue(),
                                                                       Register64(edx, eax)),
                                                         useInt64Fixed(ins->newValue(),

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_hs03.py
18 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs03.py

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs03.py
# Ensure checkpoints don't read too unnecessary history store entries.

            

Reported by Pylint.

Unused copy_wiredtiger_home imported from helper
Error

Line: 29 Column: 1

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

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs03.py

            

Reported by Pylint.

Redefining name 'stat' from outer scope (line 31)
Error

Line: 48 Column: 24

                  ]
    scenarios = make_scenarios(key_format_values)

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


            

Reported by Pylint.

Missing 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 helper import copy_wiredtiger_home"
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs03.py

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs03.py

            

Reported by Pylint.

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

Line: 31 Column: 1

              
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs03.py
# Ensure checkpoints don't read too unnecessary history store entries.

            

Reported by Pylint.

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

Line: 37 Column: 1

              
# test_hs03.py
# Ensure checkpoints don't read too unnecessary history store entries.
class test_hs03(wttest.WiredTigerTestCase):
    # Force a small cache.
    conn_config = 'cache_size=50MB,statistics=(fast)'
    session_config = 'isolation=snapshot'
    key_format_values = [
        ('column', dict(key_format='r')),

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_salvage.py
18 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_salvage.py
#    Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_salvage.a'

            

Reported by Pylint.

Unused import struct
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_salvage.py
#    Utilities: wt salvage

            

Reported by Pylint.

Unused variable 'gotkey'
Error

Line: 104 Column: 13

              
    def check_empty_table(self, tablename):
        cursor = self.session.open_cursor('table:' + tablename, None, None)
        for gotkey, gotval in cursor:
            self.fail(tablename + ': has unexpected entries')
        cursor.close()

    def damage(self, tablename):
        self.damage_inner(tablename, self.unique.encode())

            

Reported by Pylint.

Unused variable 'gotval'
Error

Line: 104 Column: 21

              
    def check_empty_table(self, tablename):
        cursor = self.session.open_cursor('table:' + tablename, None, None)
        for gotkey, gotval in cursor:
            self.fail(tablename + ': has unexpected entries')
        cursor.close()

    def damage(self, tablename):
        self.damage_inner(tablename, self.unique.encode())

            

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, struct)
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_salvage.py
#    Utilities: wt salvage

            

Reported by Pylint.

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

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_salvage.py
#    Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_salvage.a'

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_salvage.py
#    Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_salvage.a'

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              
# test_salvage.py
#    Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_salvage.a'
    nentries = 1000
    session_params = 'key_format=S,value_format=S'
    unique = 'SomeUniqueString'


            

Reported by Pylint.

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

Line: 35 Column: 1

              
# test_salvage.py
#    Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_salvage.a'
    nentries = 1000
    session_params = 'key_format=S,value_format=S'
    unique = 'SomeUniqueString'


            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/jit/mips32/Simulator-mips32.cpp
18 issues
sprintf - Does not check for buffer overflows
Security

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

                  char hexbytes[256];
    sprintf(hexbytes, "0x%x 0x%x 0x%x 0x%x", bytes[0], bytes[1], bytes[2], bytes[3]);
    char llvmcmd[1024];
    sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
            "llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
            "grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);
    if (system(llvmcmd))
        printf("Cannot disassemble instruction.\n");
}

            

Reported by FlawFinder.

system - This causes a new program to execute and is difficult to use safely
Security

Line: 810 Column: 9 CWE codes: 78
Suggestion: try using a library call that implements the same functionality if available

                  sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
            "llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
            "grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);
    if (system(llvmcmd))
        printf("Cannot disassemble instruction.\n");
}

void
MipsDebugger::debug()

            

Reported by FlawFinder.

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

Line: 537 Column: 23 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                      return nullptr;
    }

    char* stopAtStr = getenv("MIPS_SIM_STOP_AT");
    int64_t stopAt;
    if (stopAtStr && sscanf(stopAtStr, "%lld", &stopAt) == 1) {
        fprintf(stderr, "\nStopping simulation at icount %lld\n", stopAt);
        Simulator::StopSimAt = stopAt;
    }

            

Reported by FlawFinder.

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

Line: 1408 Column: 9 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

              bool
SimulatorProcess::init()
{
    if (getenv("MIPS_SIM_ICACHE_CHECKS"))
        ICacheCheckingDisableCount = 0;

    return icache_.init();
}


            

Reported by FlawFinder.

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

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

                  }

  private:
    char data_[kPageSize];   // The cached data.
    static const int kValidityMapSize = kPageSize >> kLineShift;
    char validity_map_[kValidityMapSize];  // One byte per line.
};

// Protects the icache() and redirection() properties of the

            

Reported by FlawFinder.

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

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

                private:
    char data_[kPageSize];   // The cached data.
    static const int kValidityMapSize = kPageSize >> kLineShift;
    char validity_map_[kValidityMapSize];  // One byte per line.
};

// Protects the icache() and redirection() properties of the
// Simulator.
class AutoLockSimulatorCache : public LockGuard<Mutex>

            

Reported by FlawFinder.

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

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

              ReadLine(const char* prompt)
{
    char* result = nullptr;
    char lineBuf[256];
    int offset = 0;
    bool keepGoing = true;
    fprintf(stdout, "%s", prompt);
    fflush(stdout);
    while (keepGoing) {

            

Reported by FlawFinder.

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

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

                              return nullptr;
            // Copy the existing input into the new array and set the new
            // array as the result.
            memcpy(new_result, result, offset * sizeof(char));
            js_free(result);
            result = new_result;
        }
        // Copy the newly read line into the result.
        memcpy(result + offset, lineBuf, len * sizeof(char));

            

Reported by FlawFinder.

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

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

                          result = new_result;
        }
        // Copy the newly read line into the result.
        memcpy(result + offset, lineBuf, len * sizeof(char));
        offset += len;
    }

    MOZ_ASSERT(result);
    result[offset] = '\0';

            

Reported by FlawFinder.

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

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

              DisassembleInstruction(uint32_t pc)
{
    uint8_t* bytes = reinterpret_cast<uint8_t*>(pc);
    char hexbytes[256];
    sprintf(hexbytes, "0x%x 0x%x 0x%x 0x%x", bytes[0], bytes[1], bytes[2], bytes[3]);
    char llvmcmd[1024];
    sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
            "llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
            "grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_bug019.py
18 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.

            

Reported by Pylint.

Unused SimpleDataSet imported from wtdataset
Error

Line: 32 Column: 1

              import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):
    conn_config = 'log=(enabled,file_max=100K),statistics=(fast)'

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 88 Column: 13

                  # Wait for a log file to be pre-allocated. Avoid timing problems, but
    # assert a file is created within 90 seconds.
    def prepfiles(self):
        for i in range(1,90):
            f = fnmatch.filter(os.listdir('.'), "*Prep*")
            if f:
                return
            time.sleep(1.0)
        self.fail('No pre-allocated files created after 90 seconds')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

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

Line: 29 Column: 1

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

import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.

            

Reported by Pylint.

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

Line: 31 Column: 1

              
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 36 Column: 1

              
# test_bug019.py
#    Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):
    conn_config = 'log=(enabled,file_max=100K),statistics=(fast)'
    uri = "table:bug019"
    entries = 5000
    max_initial_entries = 50000
    max_prealloc = 1

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_jsondump01.py
18 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
    ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import os
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, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
    ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
    ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused variable 'configs'
Error

Line: 115 Column: 9

                      dumpin.close()

        # spot check
        configs = tables[uri][0]
        data = tables[uri][1]["data"]
        d = data[24]
        if 'column5' in d:
            self.assertEqual(d['column5'], '25: abcde')
        else:

            

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, json)
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, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
    ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
    ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios

            

Reported by Pylint.

Missing class docstring
Error

Line: 40 Column: 1

              # A 'fake' cursor based on a set of rows.
# It emulates a WT cursor well enough for the *_check_cursor methods.
# They just need an iterable object.
class FakeCursor:
    def __init__(self, uri, keyfmt, valuefmt, rows):
        self.uri = uri
        self.key_format = keyfmt
        self.value_format = valuefmt
        self.rows = rows

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 54 Column: 5

                  def __next__(self):
        return self.next()

    def next(self):
        if self.pos >= len(self.rows):
            raise StopIteration
        else:
            row = self.rows[self.pos]
            self.pos += 1

            

Reported by Pylint.

Unnecessary "else" after "raise"
Error

Line: 55 Column: 9

                      return self.next()

    def next(self):
        if self.pos >= len(self.rows):
            raise StopIteration
        else:
            row = self.rows[self.pos]
            self.pos += 1
            tup = []

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_distutilscmd.py
18 issues
Unable to import 'extras'
Error

Line: 7 Column: 1

              
from distutils.dist import Distribution

from extras import try_import

from testtools.compat import (
    _b,
    _u,
    BytesIO,

            

Reported by Pylint.

Unused BytesIO imported from testtools.compat
Error

Line: 9 Column: 1

              
from extras import try_import

from testtools.compat import (
    _b,
    _u,
    BytesIO,
    )
fixtures = try_import('fixtures')

            

Reported by Pylint.

Unused variable 'cmd'
Error

Line: 64 Column: 9

                      dist.cmdclass = {'test': TestCommand}
        dist.command_options = {
            'test': {'test_module': ('command line', 'testtools.runexample')}}
        cmd = dist.reinitialize_command('test')
        with fixtures.MonkeyPatch('sys.stdout', stdout.stream):
            dist.run_command('test')
        self.assertThat(
            stdout.getDetails()['stdout'].as_text(),
            MatchesRegex(_u("""Tests running...

            

Reported by Pylint.

Unused variable 'cmd'
Error

Line: 86 Column: 9

                          'test': {
                'test_suite': (
                    'command line', 'testtools.runexample.test_suite')}}
        cmd = dist.reinitialize_command('test')
        with fixtures.MonkeyPatch('sys.stdout', stdout.stream):
            dist.run_command('test')
        self.assertThat(
            stdout.getDetails()['stdout'].as_text(),
            MatchesRegex(_u("""Tests running...

            

Reported by Pylint.

Import "import testtools" should be placed at the top of the module
Error

Line: 16 Column: 1

                  )
fixtures = try_import('fixtures')

import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex



            

Reported by Pylint.

Import "from testtools import TestCase" should be placed at the top of the module
Error

Line: 17 Column: 1

              fixtures = try_import('fixtures')

import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex


if fixtures:

            

Reported by Pylint.

Import "from testtools.distutilscmd import TestCommand" should be placed at the top of the module
Error

Line: 18 Column: 1

              
import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex


if fixtures:
    class SampleTestFixture(fixtures.Fixture):

            

Reported by Pylint.

Import "from testtools.matchers import MatchesRegex" should be placed at the top of the module
Error

Line: 19 Column: 1

              import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex


if fixtures:
    class SampleTestFixture(fixtures.Fixture):
        """Creates testtools.runexample temporarily."""

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 23 Column: 5

              

if fixtures:
    class SampleTestFixture(fixtures.Fixture):
        """Creates testtools.runexample temporarily."""

        def __init__(self):
            self.package = fixtures.PythonPackage(
            'runexample', [('__init__.py', _b("""

            

Reported by Pylint.

Method name "setUp" doesn't conform to snake_case naming style
Error

Line: 41 Column: 9

                  return TestLoader().loadTestsFromName(__name__)
"""))])

        def setUp(self):
            super(SampleTestFixture, self).setUp()
            self.useFixture(self.package)
            testtools.__path__.append(self.package.base)
            self.addCleanup(testtools.__path__.remove, self.package.base)


            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_home.py
18 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest

# test_isnew
#    database is-new method
class test_isnew(wttest.WiredTigerTestCase):


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest

# test_isnew
#    database is-new method
class test_isnew(wttest.WiredTigerTestCase):


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 39 Column: 9

                  # Test is-new of a connection.
    def test_isnew(self):
        # We just created a connection, is_new should return True.
        self.assertEquals(self.conn.is_new(), True)

        # Close and re-open the connection, is_new should return False.
        self.conn.close()
        self.conn = self.setUpConnectionOpen(".")
        self.assertEquals(self.conn.is_new(), False)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 44 Column: 9

                      # Close and re-open the connection, is_new should return False.
        self.conn.close()
        self.conn = self.setUpConnectionOpen(".")
        self.assertEquals(self.conn.is_new(), False)

# test_gethome
#    database get-home method
class test_gethome(wttest.WiredTigerTestCase):


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 52 Column: 9

              
    # Test gethome of a connection, the initially created one is ".".
    def test_gethome_default(self):
        self.assertEquals(self.conn.get_home(), '.')

    # Create a new database directory, open it and check its name.
    def test_gethome_new(self):
        name = 'new_database'
        os.mkdir(name)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 60 Column: 9

                      os.mkdir(name)
        self.conn.close()
        self.conn = self.setUpConnectionOpen(name)
        self.assertEquals(self.conn.get_home(), name)

# test_base_config
#       test base configuration file config.
class test_base_config(wttest.WiredTigerTestCase):
    def test_base_config(self):

            

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

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest

# test_isnew
#    database is-new method
class test_isnew(wttest.WiredTigerTestCase):


            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_isnew
#    database is-new method
class test_isnew(wttest.WiredTigerTestCase):

    # Test is-new of a connection.
    def test_isnew(self):
        # We just created a connection, is_new should return True.
        self.assertEquals(self.conn.is_new(), True)

            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_isnew
#    database is-new method
class test_isnew(wttest.WiredTigerTestCase):

    # Test is-new of a connection.
    def test_isnew(self):
        # We just created a connection, is_new should return True.
        self.assertEquals(self.conn.is_new(), True)

            

Reported by Pylint.