The following issues were found

src/third_party/wiredtiger/test/suite/test_cursor11.py
35 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

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

import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_cursor11.py

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 73 Column: 9

                      c = s.open_cursor(uri, None)

        c.set_key(ds.key(25))
        self.assertEquals(c.search(), 0)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(26))
        c.remove()
        self.assertEquals(c.get_key(), ds.key(26))
        msg = '/requires value be set/'

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 74 Column: 9

              
        c.set_key(ds.key(25))
        self.assertEquals(c.search(), 0)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(26))
        c.remove()
        self.assertEquals(c.get_key(), ds.key(26))
        msg = '/requires value be set/'
        self.assertRaisesWithMessage(

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 75 Column: 9

                      c.set_key(ds.key(25))
        self.assertEquals(c.search(), 0)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(26))
        c.remove()
        self.assertEquals(c.get_key(), ds.key(26))
        msg = '/requires value be set/'
        self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_value, msg)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 77 Column: 9

                      self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(26))
        c.remove()
        self.assertEquals(c.get_key(), ds.key(26))
        msg = '/requires value be set/'
        self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_value, msg)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(27))

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 81 Column: 9

                      msg = '/requires value be set/'
        self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_value, msg)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(27))

    # Do a remove using the cursor without setting a position, and confirm
    # no key, value or position remains.
    def test_cursor_remove_without_position(self):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 82 Column: 9

                      self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_value, msg)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(27))

    # Do a remove using the cursor without setting a position, and confirm
    # no key, value or position remains.
    def test_cursor_remove_without_position(self):
        if self.skip():

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 105 Column: 9

                      msg = '/requires value be set/'
        self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_value, msg)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(1))

    # Do a remove using the key after also setting a position, and confirm
    # no key, value or position remains.
    def test_cursor_remove_with_key_and_position(self):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 106 Column: 9

                      self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_value, msg)
        self.assertEquals(c.next(), 0)
        self.assertEquals(c.get_key(), ds.key(1))

    # Do a remove using the key after also setting a position, and confirm
    # no key, value or position remains.
    def test_cursor_remove_with_key_and_position(self):
        if self.skip():

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 122 Column: 9

                      c = s.open_cursor(uri, None)

        c.set_key(ds.key(25))
        self.assertEquals(c.search(), 0)
        c.set_key(ds.key(25))
        c.remove()
        msg = '/requires key be set/'
        self.assertRaisesWithMessage(
            wiredtiger.WiredTigerError, c.get_key, msg)

            

Reported by Pylint.

src/third_party/abseil-cpp-master/abseil-cpp/absl/container/internal/layout_test.cc
35 issues
syntax error
Error

Line: 88

                static_assert(std::is_same<Expected, Actual>(), "");
}

TEST(Layout, ElementType) {
  {
    using L = Layout<int32_t>;
    SameType<int32_t, L::ElementType<0>>();
    SameType<int32_t, decltype(L::Partial())::ElementType<0>>();
    SameType<int32_t, decltype(L::Partial(0))::ElementType<0>>();

            

Reported by Cppcheck.

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

Line: 369 Column: 39 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

              }

TEST(Layout, PointerByIndex) {
  alignas(max_align_t) const unsigned char p[100] = {};
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<0>(p))));
    EXPECT_EQ(0,
              Distance(p, Type<const int32_t*>(L::Partial(3).Pointer<0>(p))));

            

Reported by FlawFinder.

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

Line: 450 Column: 39 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

              }

TEST(Layout, PointerByType) {
  alignas(max_align_t) const unsigned char p[100] = {};
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(
        0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<int32_t>(p))));
    EXPECT_EQ(

            

Reported by FlawFinder.

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

Line: 529 Column: 33 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

              }

TEST(Layout, MutablePointerByIndex) {
  alignas(max_align_t) unsigned char p[100];
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<0>(p))));
    EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial(3).Pointer<0>(p))));
    EXPECT_EQ(0, Distance(p, Type<int32_t*>(L(3).Pointer<0>(p))));

            

Reported by FlawFinder.

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

Line: 584 Column: 33 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

              }

TEST(Layout, MutablePointerByType) {
  alignas(max_align_t) unsigned char p[100];
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<int32_t>(p))));
    EXPECT_EQ(0,
              Distance(p, Type<int32_t*>(L::Partial(3).Pointer<int32_t>(p))));

            

Reported by FlawFinder.

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

Line: 650 Column: 39 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

              }

TEST(Layout, Pointers) {
  alignas(max_align_t) const unsigned char p[100] = {};
  using L = Layout<int8_t, int8_t, Int128>;
  {
    const auto x = L::Partial();
    EXPECT_EQ(std::make_tuple(x.Pointer<0>(p)),
              Type<std::tuple<const int8_t*>>(x.Pointers(p)));

            

Reported by FlawFinder.

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

Line: 686 Column: 33 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

              }

TEST(Layout, MutablePointers) {
  alignas(max_align_t) unsigned char p[100];
  using L = Layout<int8_t, int8_t, Int128>;
  {
    const auto x = L::Partial();
    EXPECT_EQ(std::make_tuple(x.Pointer<0>(p)),
              Type<std::tuple<int8_t*>>(x.Pointers(p)));

            

Reported by FlawFinder.

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

Line: 719 Column: 39 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

              }

TEST(Layout, SliceByIndexSize) {
  alignas(max_align_t) const unsigned char p[100] = {};
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
    EXPECT_EQ(3, L::Partial(3).Slice<0>(p).size());
    EXPECT_EQ(3, L(3).Slice<0>(p).size());

            

Reported by FlawFinder.

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

Line: 747 Column: 39 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

              }

TEST(Layout, SliceByTypeSize) {
  alignas(max_align_t) const unsigned char p[100] = {};
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
    EXPECT_EQ(3, L::Partial(3).Slice<int32_t>(p).size());
    EXPECT_EQ(3, L(3).Slice<int32_t>(p).size());

            

Reported by FlawFinder.

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

Line: 769 Column: 33 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

              }

TEST(Layout, MutableSliceByIndexSize) {
  alignas(max_align_t) unsigned char p[100];
  {
    using L = Layout<int32_t>;
    EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
    EXPECT_EQ(3, L::Partial(3).Slice<0>(p).size());
    EXPECT_EQ(3, L(3).Slice<0>(p).size());

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_compress02.py
35 issues
Unable to import 'wiredtiger'
Error

Line: 32 Column: 1

              import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

# test_compress02.py

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 35 Column: 1

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

# test_compress02.py
#   This test checks that the compression level can be reconfigured after restart if
#   we are using zstd as the block compressor. Tables created before reconfiguration
#   will still use the previous compression level.

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 47 Column: 5

                  uri = "table:test_compress02"
    nrows = 1000

    def conn_config(self):
        config = 'builtin_extension_config={zstd={compression_level=6}},cache_size=10MB,log=(enabled=true)'
        return config

    def large_updates(self, uri, value, ds, nrows):
        # Update a large number of records.

            

Reported by Pylint.

Unused import fnmatch
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, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import 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, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import threading
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, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import shutil
Error

Line: 29 Column: 1

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

import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
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 fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused checkpoint_thread imported from wtthread
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

            

Reported by Pylint.

Unused op_thread imported from wtthread
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_sqrt.c
35 issues
Shifting 32-bit value by 49 bits is undefined behaviour
Error

Line: 76 CWE codes: 758

              
res.w[1] =
  sign_x |
  ((((BID_UINT64) (exponent_x + DECIMAL_EXPONENT_BIAS_128)) >> 1) << 49);
res.w[0] = 0;
BID_RETURN (res);
}
if (sign_x) {
  res.w[1] = 0x7c00000000000000ull;

            

Reported by Cppcheck.

Shifting 32-bit value by 61 bits is undefined behaviour
Error

Line: 101 CWE codes: 758

              
A10 = CX;
if (exponent_x & 1) {
  A10.w[1] = (CX.w[1] << 3) | (CX.w[0] >> 61);
  A10.w[0] = CX.w[0] << 3;
  CX2.w[1] = (CX.w[1] << 1) | (CX.w[0] >> 63);
  CX2.w[0] = CX.w[0] << 1;
  __add_128_128 (A10, A10, CX2);
}

            

Reported by Cppcheck.

Shifting 32-bit value by 63 bits is undefined behaviour
Error

Line: 103 CWE codes: 758

              if (exponent_x & 1) {
  A10.w[1] = (CX.w[1] << 3) | (CX.w[0] >> 61);
  A10.w[0] = CX.w[0] << 3;
  CX2.w[1] = (CX.w[1] << 1) | (CX.w[0] >> 63);
  CX2.w[0] = CX.w[0] << 1;
  __add_128_128 (A10, A10, CX2);
}

CS.w[0] = short_sqrt128 (A10);

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 112 CWE codes: 758

              CS.w[1] = 0;
  // check for exact result
if (CS.w[0] * CS.w[0] == A10.w[0]) {
  __mul_64x64_to_128_fast (S2, CS.w[0], CS.w[0]);
  if (S2.w[1] == A10.w[1])	// && S2.w[0]==A10.w[0])
  {
    bid_get_BID128_very_fast (&res, 0,
			  (exponent_x +
			   DECIMAL_EXPONENT_BIAS_128) >> 1, CS);

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 137 CWE codes: 758

              
if (scale > 38) {
  T128 = bid_power10_table_128[scale - 37];
  __mul_128x128_low (CX1, CX, T128);

  TP128 = bid_power10_table_128[37];
  __mul_128x128_to_256 (C256, CX1, TP128);
} else {
  T128 = bid_power10_table_128[scale];

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 140 CWE codes: 758

                __mul_128x128_low (CX1, CX, T128);

  TP128 = bid_power10_table_128[37];
  __mul_128x128_to_256 (C256, CX1, TP128);
} else {
  T128 = bid_power10_table_128[scale];
  __mul_128x128_to_256 (C256, CX, T128);
}


            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 143 CWE codes: 758

                __mul_128x128_to_256 (C256, CX1, TP128);
} else {
  T128 = bid_power10_table_128[scale];
  __mul_128x128_to_256 (C256, CX, T128);
}


  // 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);

            

Reported by Cppcheck.

Shifting 32-bit value by 62 bits is undefined behaviour
Error

Line: 148 CWE codes: 758

              

  // 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
C4.w[2] = (C256.w[2] << 2) | (C256.w[1] >> 62);
C4.w[1] = (C256.w[1] << 2) | (C256.w[0] >> 62);
C4.w[0] = C256.w[0] << 2;

bid_long_sqrt128 (&CS, C256);

            

Reported by Cppcheck.

Shifting 32-bit value by 62 bits is undefined behaviour
Error

Line: 149 CWE codes: 758

              
  // 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
C4.w[2] = (C256.w[2] << 2) | (C256.w[1] >> 62);
C4.w[1] = (C256.w[1] << 2) | (C256.w[0] >> 62);
C4.w[0] = C256.w[0] << 2;

bid_long_sqrt128 (&CS, C256);
   //printf("C256=%016I64x %016I64x %016I64x %016I64x, CS=%016I64x %016I64x \n",C256.w[3],C256.w[2],C256.w[1],C256.w[0],CS.w[1],CS.w[0]);

            

Reported by Cppcheck.

Shifting 32-bit value by 62 bits is undefined behaviour
Error

Line: 150 CWE codes: 758

                // 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
C4.w[2] = (C256.w[2] << 2) | (C256.w[1] >> 62);
C4.w[1] = (C256.w[1] << 2) | (C256.w[0] >> 62);
C4.w[0] = C256.w[0] << 2;

bid_long_sqrt128 (&CS, C256);
   //printf("C256=%016I64x %016I64x %016I64x %016I64x, CS=%016I64x %016I64x \n",C256.w[3],C256.w[2],C256.w[1],C256.w[0],CS.w[1],CS.w[0]);


            

Reported by Cppcheck.

src/third_party/wiredtiger/test/suite/test_shared_cache02.py
35 issues
Unable to import 'wiredtiger'
Error

Line: 32 Column: 1

              
import os
import shutil
import wiredtiger, wttest
from wttest import unittest

# test_shared_cache02.py
#    Shared cache tests
# Test shared cache shared amongst multiple connections.

            

Reported by Pylint.

method already defined line 125
Error

Line: 147 Column: 5

              
    # Test reconfigure that switches to using a shared cache
    # previous reserve size isn't taken into account
    def test_shared_cache_reconfig03(self):
        nops = 1000
        self.openConnections(['WT_TEST1', 'WT_TEST2'], pool_opts = ',')

        for sess in self.sessions:
            sess.create(self.uri, "key_format=S,value_format=S")

            

Reported by Pylint.

Unused unittest imported from wttest
Error

Line: 33 Column: 1

              import os
import shutil
import wiredtiger, wttest
from wttest import unittest

# test_shared_cache02.py
#    Shared cache tests
# Test shared cache shared amongst multiple connections.
class test_shared_cache02(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Parameters differ from overridden 'close_conn' method
Error

Line: 55 Column: 5

                  def setUpSessionOpen(self, conn):
        return None

    def close_conn(self):
        return None

    def setUpConnectionOpen(self, dir):
        return None


            

Reported by Pylint.

Parameters differ from overridden 'setUpConnectionOpen' method
Error

Line: 58 Column: 5

                  def close_conn(self):
        return None

    def setUpConnectionOpen(self, dir):
        return None

    def openConnections(
            self,
            connections,

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 58 Column: 35

                  def close_conn(self):
        return None

    def setUpConnectionOpen(self, dir):
        return None

    def openConnections(
            self,
            connections,

            

Reported by Pylint.

Unused argument 'dir'
Error

Line: 58 Column: 35

                  def close_conn(self):
        return None

    def setUpConnectionOpen(self, dir):
        return None

    def openConnections(
            self,
            connections,

            

Reported by Pylint.

Attribute 'conns' defined outside __init__
Error

Line: 68 Column: 13

                          extra_opts = '',
            add=0):
        if add == 0:
            self.conns = []
            self.sessions = []
        # Open the set of connections.
        for name in connections:
            shutil.rmtree(name, True)
            os.mkdir(name)

            

Reported by Pylint.

Attribute 'sessions' defined outside __init__
Error

Line: 69 Column: 13

                          add=0):
        if add == 0:
            self.conns = []
            self.sessions = []
        # Open the set of connections.
        for name in connections:
            shutil.rmtree(name, True)
            os.mkdir(name)
            next_conn =  self.wiredtiger_open(

            

Reported by Pylint.

Attribute 'conns' defined outside __init__
Error

Line: 85 Column: 9

                  def closeConnections(self):
        for tmp_conn in self.conns:
            tmp_conn.close()
        self.conns = []
        self.sessions = [] # Implicitly closed when closing sessions.

    # Test reconfigure API
    def test_shared_cache_reconfig01(self):
        nops = 1000

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_util02.py
35 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios

# test_util02.py

            

Reported by Pylint.

Undefined variable 's'
Error

Line: 109 Column: 22

                      """
        result = ''
        if type(obj) == self.stringclass:
            for c in s:
                if hexoutput:
                    result += "%0.2x" % ord(c)
                elif c == '\\':
                    result += '\\\\'
                elif c == ' ' or \

            

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 string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios

# test_util02.py

            

Reported by Pylint.

Redefining built-in 'len'
Error

Line: 54 Column: 29

                      ('ii', dict(key_format='i',value_format='i')),
    ])

    def get_string(self, i, len):
        """
        Return a pseudo-random, but predictable string that uses
        all characters.  As a special case, key 0 returns all characters
        1-255 repeated
        """

            

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 (string, 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 string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios


            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios

# test_util02.py

            

Reported by Pylint.

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

Line: 37 Column: 1

              
# test_util02.py
#    Utilities: wt load
class test_util02(wttest.WiredTigerTestCase, suite_subprocess):
    """
    Test wt load
    """

    tablename = 'test_util02.a'

            

Reported by Pylint.

Method could be a function
Error

Line: 54 Column: 5

                      ('ii', dict(key_format='i',value_format='i')),
    ])

    def get_string(self, i, len):
        """
        Return a pseudo-random, but predictable string that uses
        all characters.  As a special case, key 0 returns all characters
        1-255 repeated
        """

            

Reported by Pylint.

src/third_party/wiredtiger/test/format/backup.c
34 issues
Resource leak: fp
Error

Line: 379 CWE codes: 775

                      testutil_die(errno, "restore_backup_info fopen: %s", path);
    free(path);
    if (errno == ENOENT)
        return (RESTORE_SKIP);
    ret = fscanf(fp, "%" SCNu64 "\n", &id);
    if (ret != 1)
        testutil_die(EINVAL, "restore_backup_info ID");
    /*
     * Try to open the backup cursor. We may get ENOENT if the source ID we wrote to the program

            

Reported by Cppcheck.

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

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

              {
    uint32_t curpos, prevpos;
    int cmp;
    char filename[1024];

    if (prev == NULL)
        return;
#if 0
    active_files_print(prev, "computing removals: previous list of active files");

            

Reported by FlawFinder.

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

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

                  ssize_t rdsize;
    uint64_t offset, size, this_size, total, type;
    int rfd, wfd1, wfd2;
    char config[512], *tmp;
    bool first_pass;

    tmp_sz = 0;
    tmp = NULL;
    first_pass = true;

            

Reported by FlawFinder.

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

Line: 269 Column: 39 CWE codes: 362

                              len = strlen(g.home) + strlen(name) + 10;
                tmp = dmalloc(len);
                testutil_check(__wt_snprintf(tmp, len, "%s/%s", g.home, name));
                error_sys_check(rfd = open(tmp, O_RDONLY, 0644));
                free(tmp);
                tmp = NULL;

                len = strlen(g.home) + strlen("BACKUP") + strlen(name) + 10;
                tmp = dmalloc(len);

            

Reported by FlawFinder.

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

Line: 276 Column: 40 CWE codes: 362

                              len = strlen(g.home) + strlen("BACKUP") + strlen(name) + 10;
                tmp = dmalloc(len);
                testutil_check(__wt_snprintf(tmp, len, "%s/BACKUP/%s", g.home, name));
                error_sys_check(wfd1 = open(tmp, O_WRONLY | O_CREAT, 0644));
                free(tmp);
                tmp = NULL;

                len = strlen(g.home) + strlen("BACKUP.copy") + strlen(name) + 10;
                tmp = dmalloc(len);

            

Reported by FlawFinder.

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

Line: 283 Column: 40 CWE codes: 362

                              len = strlen(g.home) + strlen("BACKUP.copy") + strlen(name) + 10;
                tmp = dmalloc(len);
                testutil_check(__wt_snprintf(tmp, len, "%s/BACKUP.copy/%s", g.home, name));
                error_sys_check(wfd2 = open(tmp, O_WRONLY | O_CREAT, 0644));
                free(tmp);
                tmp = NULL;

                first_pass = false;
            }

            

Reported by FlawFinder.

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

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

                  size_t len;
    uint64_t id;
    uint32_t i;
    char buf[512], *path;

    testutil_assert(g.c_backup_incr_flag == INCREMENTAL_BLOCK);
    len = strlen(g.home) + strlen(BACKUP_INFO_FILE) + 2;
    path = dmalloc(len);
    testutil_check(__wt_snprintf(path, len, "%s/%s", g.home, BACKUP_INFO_FILE));

            

Reported by FlawFinder.

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

Line: 375 Column: 15 CWE codes: 362

                  testutil_check(__wt_snprintf(path, len, "%s/%s", g.home, BACKUP_INFO_FILE));
    errno = 0;
    ret = RESTORE_SUCCESS;
    if ((fp = fopen(path, "r")) == NULL && errno != ENOENT)
        testutil_die(errno, "restore_backup_info fopen: %s", path);
    free(path);
    if (errno == ENOENT)
        return (RESTORE_SKIP);
    ret = fscanf(fp, "%" SCNu64 "\n", &id);

            

Reported by FlawFinder.

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

Line: 448 Column: 15 CWE codes: 362

                  len = strlen(g.home) + strlen(BACKUP_INFO_FILE_TMP) + 2;
    from_path = dmalloc(len);
    testutil_check(__wt_snprintf(from_path, len, "%s/%s", g.home, BACKUP_INFO_FILE_TMP));
    if ((fp = fopen(from_path, "w")) == NULL)
        testutil_die(errno, "save_backup_info fopen: %s", from_path);
    fprintf(fp, "%" PRIu64 "\n", id);
    if (active->count > 0) {
        fprintf(fp, "%" PRIu32 "\n", active->count);
        for (i = 0; i < active->count; ++i)

            

Reported by FlawFinder.

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

Line: 480 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_int incremental, period;
    uint64_t src_id, this_id;
    const char *config, *key;
    char cfg[512];
    bool full, incr_full;

    (void)(arg);

    conn = g.wts_conn;

            

Reported by FlawFinder.

src/third_party/mozjs-60/extract/js/src/jit/mips64/MacroAssembler-mips64.cpp
34 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: 1090 Column: 79 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              }

void
MacroAssemblerMIPS64Compat::loadUnalignedDouble(const wasm::MemoryAccessDesc& access,
                                                const BaseIndex& src, Register temp, FloatRegister dest)
{
    computeScaledAddress(src, SecondScratchReg);
    BufferOffset load;
    if (Imm16::IsInSignedRange(src.offset) && Imm16::IsInSignedRange(src.offset + 7)) {

            

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: 1104 Column: 12 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      load = as_ldl(temp, ScratchRegister, 7);
        as_ldr(temp, ScratchRegister, 0);
    }
    append(access, load.getOffset(), asMasm().framePushed());
    moveToDouble(temp, dest);
}

void
MacroAssemblerMIPS64Compat::loadUnalignedFloat32(const wasm::MemoryAccessDesc& access,

            

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: 1109 Column: 80 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              }

void
MacroAssemblerMIPS64Compat::loadUnalignedFloat32(const wasm::MemoryAccessDesc& access,
                                                 const BaseIndex& src, Register temp, FloatRegister dest)
{
    computeScaledAddress(src, SecondScratchReg);
    BufferOffset load;
    if (Imm16::IsInSignedRange(src.offset) && Imm16::IsInSignedRange(src.offset + 3)) {

            

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: 1123 Column: 12 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      load = as_lwl(temp, ScratchRegister, 3);
        as_lwr(temp, ScratchRegister, 0);
    }
    append(access, load.getOffset(), asMasm().framePushed());
    moveToFloat32(temp, dest);
}

void
MacroAssemblerMIPS64Compat::store8(Imm32 imm, const Address& address)

            

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: 1261 Column: 81 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              }

void
MacroAssemblerMIPS64Compat::storeUnalignedFloat32(const wasm::MemoryAccessDesc& access,
                                                  FloatRegister src, Register temp, const BaseIndex& dest)
{
    computeScaledAddress(dest, SecondScratchReg);
    moveFromFloat32(src, temp);
    BufferOffset store;

            

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: 1276 Column: 12 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      store = as_swl(temp, ScratchRegister, 3);
        as_swr(temp, ScratchRegister, 0);
    }
    append(access, store.getOffset(), asMasm().framePushed());
}

void
MacroAssemblerMIPS64Compat::storeUnalignedDouble(const wasm::MemoryAccessDesc& access,
                                                 FloatRegister src, Register temp, const BaseIndex& dest)

            

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: 1280 Column: 80 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              }

void
MacroAssemblerMIPS64Compat::storeUnalignedDouble(const wasm::MemoryAccessDesc& access,
                                                 FloatRegister src, Register temp, const BaseIndex& dest)
{
    computeScaledAddress(dest, SecondScratchReg);
    moveFromDouble(src, temp);


            

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: 1296 Column: 12 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      store = as_sdl(temp, ScratchRegister, 7);
        as_sdr(temp, ScratchRegister, 0);
    }
    append(access, store.getOffset(), asMasm().framePushed());
}

void
MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
{

            

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: 2351 Column: 59 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              }

void
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
                            Register ptrScratch, Register64 output)
{
    wasmLoadI64Impl(access, memoryBase, ptr, ptrScratch, output, InvalidReg);
}


            

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: 2354 Column: 21 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
                            Register ptrScratch, Register64 output)
{
    wasmLoadI64Impl(access, memoryBase, ptr, ptrScratch, output, InvalidReg);
}

void
MacroAssembler::wasmUnalignedLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase,
                                     Register ptr, Register ptrScratch, Register64 output,

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/matchers/_datastructures.py
34 issues
Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              
"""Matchers that operate with knowledge of Python data structures."""

from ..helpers import map_values
from ._higherorder import (
    Annotate,
    MatchesAll,
    MismatchesAll,
    )

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              """Matchers that operate with knowledge of Python data structures."""

from ..helpers import map_values
from ._higherorder import (
    Annotate,
    MatchesAll,
    MismatchesAll,
    )
from ._impl import Mismatch

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

                  MatchesAll,
    MismatchesAll,
    )
from ._impl import Mismatch


def ContainsAll(items):
    """Make a matcher that checks whether a list of things is contained
    in another thing.

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 28 Column: 5

                  The matcher effectively checks that the provided sequence is a subset of
    the matchee.
    """
    from ._basic import Contains
    return MatchesAll(*map(Contains, items), first_only=False)


class MatchesListwise(object):
    """Matches if each matcher matches the corresponding value.

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 61 Column: 9

                      self.first_only = first_only

    def match(self, values):
        from ._basic import Equals
        mismatches = []
        length_mismatch = Annotate(
            "Length mismatch", Equals(len(self.matchers))).match(len(values))
        if length_mismatch:
            mismatches.append(length_mismatch)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 108 Column: 9

                      Similar to the constructor, except that the matcher is assumed to be
        Equals.
        """
        from ._basic import Equals
        return cls.byMatcher(Equals, **kwargs)

    @classmethod
    def byMatcher(cls, matcher, **kwargs):
        """Matches an object where the attributes match the keyword values.

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 122 Column: 9

              
    @classmethod
    def fromExample(cls, example, *attributes):
        from ._basic import Equals
        kwargs = {}
        for attr in attributes:
            kwargs[attr] = Equals(getattr(example, attr))
        return cls(**kwargs)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2009-2012 testtools developers. See LICENSE for details.

__all__ = [
    'ContainsAll',
    'MatchesListwise',
    'MatchesSetwise',
    'MatchesStructure',
    ]


            

Reported by Pylint.

Import "from ..helpers import map_values" should be placed at the top of the module
Error

Line: 12 Column: 1

              
"""Matchers that operate with knowledge of Python data structures."""

from ..helpers import map_values
from ._higherorder import (
    Annotate,
    MatchesAll,
    MismatchesAll,
    )

            

Reported by Pylint.

Import "from ._higherorder import Annotate, MatchesAll, MismatchesAll" should be placed at the top of the module
Error

Line: 13 Column: 1

              """Matchers that operate with knowledge of Python data structures."""

from ..helpers import map_values
from ._higherorder import (
    Annotate,
    MatchesAll,
    MismatchesAll,
    )
from ._impl import Mismatch

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_bug001.py
34 issues
Unable to import 'wiredtiger'
Error

Line: 32 Column: 1

              # test_bug001.py
#       Regression tests.

import wiredtiger, wttest

# Regression tests.
class test_bug001(wttest.WiredTigerTestCase):

    def create_implicit(self, uri, initial, middle, trailing):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 32 Column: 1

              # test_bug001.py
#       Regression tests.

import wiredtiger, wttest

# Regression tests.
class test_bug001(wttest.WiredTigerTestCase):

    def create_implicit(self, uri, initial, middle, trailing):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 44 Column: 13

                      # Create a set of initial implicit records, followed by a set of real
        # records, followed by a set of trailing implicit records.
        r = initial
        for i in range(0, middle):
            r += 1
            cursor[r] = 0xab
        r += trailing
        cursor[r + 1] = 0xbb
        return (cursor)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 62 Column: 9

              
        # Check cursor next inside trailing implicit keys.
        cursor.set_key(60)
        self.assertEquals(cursor.search(), 0)
        for i in range(0, 5):
            self.assertEqual(cursor.get_key(), 60 + i)
            self.assertEqual(cursor.get_value(), 0x00)
            self.assertEqual(cursor.next(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 70 Column: 9

              
        # Check cursor prev inside trailing implicit keys.
        cursor.set_key(60)
        self.assertEquals(cursor.search(), 0)
        for i in range(0, 5):
            self.assertEqual(cursor.get_key(), 60 - i)
            self.assertEqual(cursor.get_value(), 0x00)
            self.assertEqual(cursor.prev(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 76 Column: 9

                          self.assertEqual(cursor.get_value(), 0x00)
            self.assertEqual(cursor.prev(), 0)

        self.assertEquals(cursor.close(), 0)
        self.session.drop(uri)
        cursor = self.create_implicit(uri, 20, 50, 0)

        # Check search inside leading implicit keys.
        for i in range(0, 5):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 86 Column: 9

              
        # Check cursor next inside leading implicit keys.
        cursor.set_key(10)
        self.assertEquals(cursor.search(), 0)
        for i in range(0, 5):
            self.assertEqual(cursor.get_key(), 10 + i)
            self.assertEqual(cursor.get_value(), 0x00)
            self.assertEqual(cursor.next(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 94 Column: 9

              
        # Check cursor prev inside leading implicit keys.
        cursor.set_key(10)
        self.assertEquals(cursor.search(), 0)
        for i in range(0, 5):
            self.assertEqual(cursor.get_key(), 10 - i)
            self.assertEqual(cursor.get_value(), 0x00)
            self.assertEqual(cursor.prev(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 100 Column: 9

                          self.assertEqual(cursor.get_value(), 0x00)
            self.assertEqual(cursor.prev(), 0)

        self.assertEquals(cursor.close(), 0)
        self.session.drop(uri)

    # Test a bug where cursor remove inside implicit records looped infinitely.
    def test_implicit_record_cursor_remove(self):
        uri='file:xxx'

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 110 Column: 9

              
        # Check cursor next/remove inside trailing implicit keys.
        cursor.set_key(62)
        self.assertEquals(cursor.search(), 0)
        for i in range(1, 5):
            self.assertEquals(cursor.next(), 0)
            self.assertEqual(cursor.get_key(), 62 + i)
            self.assertEqual(cursor.get_value(), 0x00)
            self.assertEquals(cursor.remove(), 0)

            

Reported by Pylint.