The following issues were found

src/third_party/wiredtiger/test/suite/helper.py
24 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              #

import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently.  To make sure we get byte for byte comparison,

            

Reported by Pylint.

Unused import string
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.
#

import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach

            

Reported by Pylint.

Unused SimpleDataSet imported from wtdataset
Error

Line: 33 Column: 1

              import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently.  To make sure we get byte for byte comparison,
# we define it here.
def compare_files(testcase, filename1, filename2):

            

Reported by Pylint.

Unused ComplexDataSet imported from wtdataset
Error

Line: 33 Column: 1

              import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently.  To make sure we get byte for byte comparison,
# we define it here.
def compare_files(testcase, filename1, filename2):

            

Reported by Pylint.

Unused SimpleIndexDataSet imported from wtdataset
Error

Line: 33 Column: 1

              import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach
# file comparison differently.  To make sure we get byte for byte comparison,
# we define it here.
def compare_files(testcase, filename1, filename2):

            

Reported by Pylint.

Unused argument 'testcase'
Error

Line: 58 Column: 20

                                  return True

# Iterate over a set of tables, ensuring that they have identical contents
def compare_tables(testcase, session, uris, config=None):
    cursors = list()
    for next_uri in uris:
        cursors.append(session.open_cursor(next_uri, None, config))

    try:

            

Reported by Pylint.

Unused variable 'key'
Error

Line: 95 Column: 13

                  testcase.pr('confirm_empty: ' + uri)
    cursor = testcase.session.open_cursor(uri, None)
    if cursor.value_format == '8t':
        for key,val in cursor:
            testcase.assertEqual(val, 0)
    else:
        testcase.assertEqual(cursor.next(), wiredtiger.WT_NOTFOUND)
    cursor.close()


            

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 (glob, os, shutil, string, subprocess)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.
#

import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 30
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              # OTHER DEALINGS IN THE SOFTWARE.
#

import glob, os, shutil, string, subprocess
import wiredtiger

from wtdataset import SimpleDataSet, SimpleIndexDataSet, ComplexDataSet

# Python has a filecmp.cmp function, but different versions of python approach

            

Reported by Bandit.

src/mongo/db/cst/parser_gen.hpp
24 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 370 Column: 13 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

                      /// An auxiliary type to compute the largest semantic type.
        union union_type {
            // "BinData"
            char dummy1[sizeof(BSONBinData)];

            // "Code"
            char dummy2[sizeof(BSONCode)];

            // "CodeWScope"

            

Reported by FlawFinder.

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

Line: 373 Column: 13 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

                          char dummy1[sizeof(BSONBinData)];

            // "Code"
            char dummy2[sizeof(BSONCode)];

            // "CodeWScope"
            char dummy3[sizeof(BSONCodeWScope)];

            // "dbPointer"

            

Reported by FlawFinder.

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

Line: 376 Column: 13 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

                          char dummy2[sizeof(BSONCode)];

            // "CodeWScope"
            char dummy3[sizeof(BSONCodeWScope)];

            // "dbPointer"
            char dummy4[sizeof(BSONDBRef)];

            // "regex"

            

Reported by FlawFinder.

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

Line: 379 Column: 13 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

                          char dummy3[sizeof(BSONCodeWScope)];

            // "dbPointer"
            char dummy4[sizeof(BSONDBRef)];

            // "regex"
            char dummy5[sizeof(BSONRegEx)];

            // "Symbol"

            

Reported by FlawFinder.

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

Line: 382 Column: 13 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

                          char dummy4[sizeof(BSONDBRef)];

            // "regex"
            char dummy5[sizeof(BSONRegEx)];

            // "Symbol"
            char dummy6[sizeof(BSONSymbol)];

            // dbPointer

            

Reported by FlawFinder.

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

Line: 385 Column: 13 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

                          char dummy5[sizeof(BSONRegEx)];

            // "Symbol"
            char dummy6[sizeof(BSONSymbol)];

            // dbPointer
            // javascript
            // symbol
            // javascriptWScope

            

Reported by FlawFinder.

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

Line: 586 Column: 13 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

                          // metaSort
            // oneOrNegOne
            // metaSortKeyword
            char dummy7[sizeof(CNode)];

            // aggregationProjectionFieldname
            // projectionFieldname
            // expressionFieldname
            // stageAsUserFieldname

            

Reported by FlawFinder.

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

Line: 603 Column: 13 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

                          // valueFieldname
            // predFieldname
            // logicalExprField
            char dummy8[sizeof(CNode::Fieldname)];

            // "Date"
            char dummy9[sizeof(Date_t)];

            // "arbitrary decimal"

            

Reported by FlawFinder.

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

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

                          char dummy8[sizeof(CNode::Fieldname)];

            // "Date"
            char dummy9[sizeof(Date_t)];

            // "arbitrary decimal"
            char dummy10[sizeof(Decimal128)];

            // "ObjectID"

            

Reported by FlawFinder.

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

Line: 609 Column: 13 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

                          char dummy9[sizeof(Date_t)];

            // "arbitrary decimal"
            char dummy10[sizeof(Decimal128)];

            // "ObjectID"
            char dummy11[sizeof(OID)];

            // "Timestamp"

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_overwrite.py
24 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 filter_scenarios, make_scenarios

# test_overwrite.py

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 67 Column: 55

                      cursor = self.session.open_cursor(uri, None, "overwrite=false")
        cursor.set_key(ds.key(5))
        cursor.set_value(ds.value(1000))
        self.assertRaises(wiredtiger.WiredTigerError, lambda: cursor.insert())

        # One additional test for the insert method: duplicate the cursor with
        # overwrite configured and then the insert should succeed.  This test
        # is only for the insert method because the remove and update method
        # failure modes are for non-existent records, and you cannot duplicate

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 78 Column: 9

                      cursor.set_key(ds.key(5))
        dupc = self.session.open_cursor(None, cursor, "overwrite=true")
        dupc.set_value(ds.value(1001))
        self.assertEquals(dupc.insert(), 0)

        # Insert of an existing record with overwrite on succeeds.
        cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(6))
        cursor.set_value(ds.value(1002))

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 84 Column: 9

                      cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(6))
        cursor.set_value(ds.value(1002))
        self.assertEquals(cursor.insert(), 0)

        # Insert of a non-existent record with overwrite off succeeds.
        cursor = self.session.open_cursor(uri, None, "overwrite=false")
        cursor.set_key(ds.key(200))
        cursor.set_value(ds.value(1003))

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 90 Column: 9

                      cursor = self.session.open_cursor(uri, None, "overwrite=false")
        cursor.set_key(ds.key(200))
        cursor.set_value(ds.value(1003))
        self.assertEquals(cursor.insert(), 0)

        # Insert of a non-existent record with overwrite on succeeds.
        cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(201))
        cursor.set_value(ds.value(1004))

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 96 Column: 9

                      cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(201))
        cursor.set_value(ds.value(1004))
        self.assertEquals(cursor.insert(), 0)

    def test_overwrite_remove(self):
        uri = self.uri + self.name
        ds = self.ds(self, uri, 100, key_format=self.keyfmt)
        ds.populate()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 106 Column: 9

                      # Remove of an existing record with overwrite off succeeds.
        cursor = self.session.open_cursor(uri, None, "overwrite=false")
        cursor.set_key(ds.key(5))
        self.assertEquals(cursor.remove(), 0)

        # Remove of an existing record with overwrite on succeeds.
        cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(6))
        self.assertEquals(cursor.remove(), 0)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 111 Column: 9

                      # Remove of an existing record with overwrite on succeeds.
        cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(6))
        self.assertEquals(cursor.remove(), 0)

        # Remove of a non-existent record with overwrite off fails.
        cursor = self.session.open_cursor(uri, None, "overwrite=false")
        cursor.set_key(ds.key(200))
        self.assertEquals(cursor.remove(), wiredtiger.WT_NOTFOUND)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 116 Column: 9

                      # Remove of a non-existent record with overwrite off fails.
        cursor = self.session.open_cursor(uri, None, "overwrite=false")
        cursor.set_key(ds.key(200))
        self.assertEquals(cursor.remove(), wiredtiger.WT_NOTFOUND)

        # Remove of a non-existent record with overwrite on succeeds.
        cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(201))
        self.assertEquals(cursor.remove(), 0)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 121 Column: 9

                      # Remove of a non-existent record with overwrite on succeeds.
        cursor = self.session.open_cursor(uri, None)
        cursor.set_key(ds.key(201))
        self.assertEquals(cursor.remove(), 0)

    def test_overwrite_update(self):
        uri = self.uri + self.name
        ds = self.ds(self, uri, 100, key_format=self.keyfmt)
        ds.populate()

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/matchers/test_impl.py
24 issues
Undefined variable 'unicode'
Error

Line: 100 Column: 22

                      if str_is_unicode:
            actual = str(e)
        else:
            actual = unicode(e)
            # Using str() should still work, and return ascii only
            self.assertEqual(
                expected.replace(matchee, matchee.encode("unicode-escape")),
                str(e).decode("ascii"))
        self.assertEqual(expected, actual)

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 27 Column: 1

              from testtools.tests.helpers import FullStackRunTest

# Silence pyflakes.
Matcher


class TestMismatch(TestCase):

    run_tests_with = FullStackRunTest

            

Reported by Pylint.

Missing class docstring
Error

Line: 30 Column: 1

              Matcher


class TestMismatch(TestCase):

    run_tests_with = FullStackRunTest

    def test_constructor_arguments(self):
        mismatch = Mismatch("some description", {'detail': "things"})

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 34 Column: 5

              
    run_tests_with = FullStackRunTest

    def test_constructor_arguments(self):
        mismatch = Mismatch("some description", {'detail': "things"})
        self.assertEqual("some description", mismatch.describe())
        self.assertEqual({'detail': "things"}, mismatch.get_details())

    def test_constructor_no_arguments(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 39 Column: 5

                      self.assertEqual("some description", mismatch.describe())
        self.assertEqual({'detail': "things"}, mismatch.get_details())

    def test_constructor_no_arguments(self):
        mismatch = Mismatch()
        self.assertThat(mismatch.describe,
            Raises(MatchesException(NotImplementedError)))
        self.assertEqual({}, mismatch.get_details())


            

Reported by Pylint.

Missing class docstring
Error

Line: 46 Column: 1

                      self.assertEqual({}, mismatch.get_details())


class TestMismatchError(TestCase):

    def test_is_assertion_error(self):
        # MismatchError is an AssertionError, so that most of the time, it
        # looks like a test failure, rather than an error.
        def raise_mismatch_error():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 5

              
class TestMismatchError(TestCase):

    def test_is_assertion_error(self):
        # MismatchError is an AssertionError, so that most of the time, it
        # looks like a test failure, rather than an error.
        def raise_mismatch_error():
            raise MismatchError(2, Equals(3), Equals(3).match(2))
        self.assertRaises(AssertionError, raise_mismatch_error)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 55 Column: 5

                          raise MismatchError(2, Equals(3), Equals(3).match(2))
        self.assertRaises(AssertionError, raise_mismatch_error)

    def test_default_description_is_mismatch(self):
        mismatch = Equals(3).match(2)
        e = MismatchError(2, Equals(3), mismatch)
        self.assertEqual(mismatch.describe(), str(e))

    def test_default_description_unicode(self):

            

Reported by Pylint.

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

Line: 57 Column: 9

              
    def test_default_description_is_mismatch(self):
        mismatch = Equals(3).match(2)
        e = MismatchError(2, Equals(3), mismatch)
        self.assertEqual(mismatch.describe(), str(e))

    def test_default_description_unicode(self):
        matchee = _u('\xa7')
        matcher = Equals(_u('a'))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 60 Column: 5

                      e = MismatchError(2, Equals(3), mismatch)
        self.assertEqual(mismatch.describe(), str(e))

    def test_default_description_unicode(self):
        matchee = _u('\xa7')
        matcher = Equals(_u('a'))
        mismatch = matcher.match(matchee)
        e = MismatchError(matchee, matcher, mismatch)
        self.assertEqual(mismatch.describe(), str(e))

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/runner/latency.py
24 issues
Unused variable 'i'
Error

Line: 62 Column: 13

                  pos = 0
    for x in range(0, width):
        t = 0
        for i in range(0, merge):
            t += arr[pos]
            pos += 1
        nch = scale * t
        y = 0
        while nch > 0.0:

            

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.

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

Line: 34 Column: 1

              from __future__ import print_function
import sys

def _show_buckets(fh, title, mult, buckets, n):
    shown = False
    s = title + ': '
    for count in range(0, n):
        val = buckets[count]
        if val != 0:

            

Reported by Pylint.

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

Line: 34 Column: 1

              from __future__ import print_function
import sys

def _show_buckets(fh, title, mult, buckets, n):
    shown = False
    s = title + ': '
    for count in range(0, n):
        val = buckets[count]
        if val != 0:

            

Reported by Pylint.

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

Line: 36 Column: 5

              
def _show_buckets(fh, title, mult, buckets, n):
    shown = False
    s = title + ': '
    for count in range(0, n):
        val = buckets[count]
        if val != 0:
            if shown:
                s += ','

            

Reported by Pylint.

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

Line: 41 Column: 17

                      val = buckets[count]
        if val != 0:
            if shown:
                s += ','
            s += str(count*mult) + '=' + str(val)
            shown = True
    print(s, file=fh)

def _latency_preprocess(arr, merge):

            

Reported by Pylint.

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

Line: 42 Column: 13

                      if val != 0:
            if shown:
                s += ','
            s += str(count*mult) + '=' + str(val)
            shown = True
    print(s, file=fh)

def _latency_preprocess(arr, merge):
    mx = 0

            

Reported by Pylint.

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

Line: 47 Column: 5

                  print(s, file=fh)

def _latency_preprocess(arr, merge):
    mx = 0
    cur = 0
    # SWIG arrays have a clunky interface
    for i in range(0, arr.__len__()):
        if i % merge == 0:
            cur = 0

            

Reported by Pylint.

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

Line: 55 Column: 13

                          cur = 0
        cur += arr[i]
        if cur > mx:
            mx = cur
    arr.height = mx

def _latency_plot(box, ch, left, width, arr, merge, scale):
    pos = 0
    for x in range(0, width):

            

Reported by Pylint.

Too many arguments (7/5)
Error

Line: 58 Column: 1

                          mx = cur
    arr.height = mx

def _latency_plot(box, ch, left, width, arr, merge, scale):
    pos = 0
    for x in range(0, width):
        t = 0
        for i in range(0, merge):
            t += arr[pos]

            

Reported by Pylint.

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

              // wasm support

void
MacroAssembler::wasmLoad(const wasm::MemoryAccessDesc& access, Operand srcAddr, AnyRegister out)
{
    memoryBarrierBefore(access.sync());

    size_t loadOffset = size();
    switch (access.type()) {

            

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

              void
MacroAssembler::wasmLoad(const wasm::MemoryAccessDesc& access, Operand srcAddr, AnyRegister out)
{
    memoryBarrierBefore(access.sync());

    size_t loadOffset = size();
    switch (access.type()) {
      case Scalar::Int8:
        movsbl(srcAddr, out.gpr());

            

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

                  memoryBarrierBefore(access.sync());

    size_t loadOffset = size();
    switch (access.type()) {
      case Scalar::Int8:
        movsbl(srcAddr, out.gpr());
        break;
      case Scalar::Uint8:
        movzbl(srcAddr, out.gpr());

            

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

                      loadDouble(srcAddr, out.fpu());
        break;
      case Scalar::Float32x4:
        switch (access.numSimdElems()) {
          // In memory-to-register mode, movss zeroes out the high lanes.
          case 1: loadFloat32(srcAddr, out.fpu()); break;
          // See comment above, which also applies to movsd.
          case 2: loadDouble(srcAddr, out.fpu()); break;
          case 4: loadUnalignedSimd128Float(srcAddr, out.fpu()); 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: 632 Column: 17 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      }
        break;
      case Scalar::Int32x4:
        switch (access.numSimdElems()) {
          // In memory-to-register mode, movd zeroes out the high lanes.
          case 1: vmovd(srcAddr, out.fpu()); break;
          // See comment above, which also applies to movq.
          case 2: vmovq(srcAddr, out.fpu()); break;
          case 4: loadUnalignedSimd128Int(srcAddr, out.fpu()); 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: 642 Column: 20 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      }
        break;
      case Scalar::Int8x16:
        MOZ_ASSERT(access.numSimdElems() == 16, "unexpected partial load");
        loadUnalignedSimd128Int(srcAddr, out.fpu());
        break;
      case Scalar::Int16x8:
        MOZ_ASSERT(access.numSimdElems() == 8, "unexpected partial load");
        loadUnalignedSimd128Int(srcAddr, out.fpu());

            

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

                      loadUnalignedSimd128Int(srcAddr, out.fpu());
        break;
      case Scalar::Int16x8:
        MOZ_ASSERT(access.numSimdElems() == 8, "unexpected partial load");
        loadUnalignedSimd128Int(srcAddr, out.fpu());
        break;
      case Scalar::Int64:
        MOZ_CRASH("int64 loads must use load64");
      case Scalar::Uint8Clamped:

            

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

                    case Scalar::MaxTypedArrayViewType:
        MOZ_CRASH("unexpected array type");
    }
    append(access, loadOffset, framePushed());

    memoryBarrierAfter(access.sync());
}

void

            

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

                  }
    append(access, loadOffset, framePushed());

    memoryBarrierAfter(access.sync());
}

void
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Operand srcAddr, Register64 out)
{

            

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: 661 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, Operand srcAddr, Register64 out)
{
    memoryBarrierBefore(access.sync());

    MOZ_ASSERT(!access.isSimd());


            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_txn04.py
24 issues
An attribute defined in wttest line 401 hides this method
Error

Line: 72 Column: 5

              
    scenarios = make_scenarios(types, op1s, txn1s)

    def conn_config(self):
        # Cycle through the different transaction_sync values in a
        # deterministic manner.
        txn_sync = self.sync_list[
            self.scenario_number % len(self.sync_list)]
        # Set archive false on the home directory.

            

Reported by Pylint.

Attribute 'session2' defined outside __init__
Error

Line: 145 Column: 13

                          # The runWt command closes our connection and sessions so
            # we need to reopen them here.
            self.hot_backup(None, committed)
            self.session2 = self.conn.open_session()
            c = self.session.open_cursor(self.uri, None, 'overwrite')
            c.set_value(1)
            # Then do the given modification.
            # Perform a targeted hot backup.
            self.session.begin_transaction()

            

Reported by Pylint.

Attribute 'backup_dir' defined outside __init__
Error

Line: 192 Column: 9

                      # print 'Call hot_backup with ' + self.uri
        self.hot_backup(self.uri, committed)
    def test_ops(self):
        self.backup_dir = os.path.join(self.home, "WT_BACKUP")
        self.session2 = self.conn.open_session()
        with self.expectedStdoutPattern('recreating metadata'):
            self.ops()

if __name__ == '__main__':

            

Reported by Pylint.

Attribute 'session2' defined outside __init__
Error

Line: 193 Column: 9

                      self.hot_backup(self.uri, committed)
    def test_ops(self):
        self.backup_dir = os.path.join(self.home, "WT_BACKUP")
        self.session2 = self.conn.open_session()
        with self.expectedStdoutPattern('recreating metadata'):
            self.ops()

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

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (shutil, os)
Error

Line: 38 Column: 1

              #   Transactions: hot backup and recovery
#

import shutil, os
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest

class test_txn04(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Missing class docstring
Error

Line: 43 Column: 1

              from wtscenario import make_scenarios
import wttest

class test_txn04(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn04'
    uri = 'table:' + tablename
    sync_list = [
        '(method=dsync,enabled)',

            

Reported by Pylint.

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

Line: 43 Column: 1

              from wtscenario import make_scenarios
import wttest

class test_txn04(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn04'
    uri = 'table:' + tablename
    sync_list = [
        '(method=dsync,enabled)',

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 72 Column: 5

              
    scenarios = make_scenarios(types, op1s, txn1s)

    def conn_config(self):
        # Cycle through the different transaction_sync values in a
        # deterministic manner.
        txn_sync = self.sync_list[
            self.scenario_number % len(self.sync_list)]
        # Set archive false on the home directory.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 83 Column: 5

              
    # Check that a cursor (optionally started in a new transaction), sees the
    # expected values.
    def check(self, session, txn_config, expected):
        if txn_config:
            session.begin_transaction(txn_config)
        c = session.open_cursor(self.uri, None)
        actual = dict((k, v) for k, v in c if v != 0)
        # Search for the expected items as well as iterating

            

Reported by Pylint.

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

Line: 162 CWE codes: 758

                // CONVERT X
  sig_x.w[1] = x.w[1] & 0x0001ffffffffffffull;
  sig_x.w[0] = x.w[0];
  exp_x = (x.w[1] >> 49) & 0x000000000003fffull;

  // CONVERT Y
  exp_y = (y.w[1] >> 49) & 0x0000000000003fffull;
  sig_y.w[1] = y.w[1] & 0x0001ffffffffffffull;
  sig_y.w[0] = y.w[0];

            

Reported by Cppcheck.

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

Line: 165 CWE codes: 758

                exp_x = (x.w[1] >> 49) & 0x000000000003fffull;

  // CONVERT Y
  exp_y = (y.w[1] >> 49) & 0x0000000000003fffull;
  sig_y.w[1] = y.w[1] & 0x0001ffffffffffffull;
  sig_y.w[0] = y.w[0];

  // ZERO (CASE4)
  // some properties:

            

Reported by Cppcheck.

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

Line: 235 CWE codes: 758

                    BID_RETURN (res);
    }
    if (diff > 19) {	//128 by 128 bit multiply -> 256 bits
      __mul_128x128_to_256 (sig_n_prime256, sig_x, bid_ten2k128[diff - 20]);
      // if postitive, return whichever significand is larger 
      // (converse if negative)
      res = ((((sig_n_prime256.w[3] > 0) || sig_n_prime256.w[2] > 0)
	      || (sig_n_prime256.w[1] > sig_y.w[1])
	      || (sig_n_prime256.w[1] == sig_y.w[1]

            

Reported by Cppcheck.

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

Line: 246 CWE codes: 758

              				  MASK_SIGN)) ? y : x;
      BID_RETURN (res);
    }
    __mul_64x128_to_192 (sig_n_prime192, bid_ten2k64[diff], sig_x);
    // if postitive, return whichever significand is larger 
    // (converse if negative)
    res =
      (((sig_n_prime192.w[2] > 0) || (sig_n_prime192.w[1] > sig_y.w[1])
	|| (sig_n_prime192.w[1] == sig_y.w[1]

            

Reported by Cppcheck.

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

Line: 264 CWE codes: 758

                }
  if (diff > 19) {	//128 by 128 bit multiply -> 256 bits
    // adjust the y significand upwards
    __mul_128x128_to_256 (sig_n_prime256, sig_y, bid_ten2k128[diff - 20]);
    // if postitive, return whichever significand is larger 
    // (converse if negative)
    res =
      ((sig_n_prime256.w[3] != 0 || sig_n_prime256.w[2] != 0
	|| (sig_n_prime256.w[1] > sig_x.w[1]

            

Reported by Cppcheck.

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

Line: 277 CWE codes: 758

                  BID_RETURN (res);
  }
  // adjust the y significand upwards
  __mul_64x128_to_192 (sig_n_prime192, bid_ten2k64[diff], sig_y);
  // if postitive, return whichever significand is larger (converse if negative)
  res =
    ((sig_n_prime192.w[2] != 0
      || (sig_n_prime192.w[1] > sig_x.w[1]
	  || (sig_n_prime192.w[1] == sig_x.w[1]

            

Reported by Cppcheck.

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

Line: 417 CWE codes: 758

                // CONVERT X
  sig_x.w[1] = x.w[1] & 0x0001ffffffffffffull;
  sig_x.w[0] = x.w[0];
  exp_x = (x.w[1] >> 49) & 0x000000000003fffull;

  // CONVERT Y
  exp_y = (y.w[1] >> 49) & 0x0000000000003fffull;
  sig_y.w[1] = y.w[1] & 0x0001ffffffffffffull;
  sig_y.w[0] = y.w[0];

            

Reported by Cppcheck.

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

Line: 420 CWE codes: 758

                exp_x = (x.w[1] >> 49) & 0x000000000003fffull;

  // CONVERT Y
  exp_y = (y.w[1] >> 49) & 0x0000000000003fffull;
  sig_y.w[1] = y.w[1] & 0x0001ffffffffffffull;
  sig_y.w[0] = y.w[0];

  // ZERO (CASE4)
  // some properties:

            

Reported by Cppcheck.

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

Line: 481 CWE codes: 758

                    BID_RETURN (res);
    }
    if (diff > 19) {	//128 by 128 bit multiply -> 256 bits
      __mul_128x128_to_256 (sig_n_prime256, sig_x, bid_ten2k128[diff - 20]);
      // if positive, return whichever significand is larger 
      // (converse if negative)
      if (sig_n_prime256.w[3] == 0 && (sig_n_prime256.w[2] == 0)
	  && sig_n_prime256.w[1] == sig_y.w[1]
	  && (sig_n_prime256.w[0] == sig_y.w[0])) {

            

Reported by Cppcheck.

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

Line: 496 CWE codes: 758

              		 && sig_n_prime256.w[0] > sig_y.w[0])) ? y : x;
      BID_RETURN (res);
    }
    __mul_64x128_to_192 (sig_n_prime192, bid_ten2k64[diff], sig_x);
    // if positive, return whichever significand is larger 
    // (converse if negative)
    if ((sig_n_prime192.w[2] == 0) && sig_n_prime192.w[1] == sig_y.w[1]
	&& (sig_n_prime192.w[0] == sig_y.w[0])) {
      // if = in magnitude, return +, (if possible)

            

Reported by Cppcheck.

src/third_party/wiredtiger/lang/python/wiredtiger/packutil.py
24 issues
Undefined variable 'unicode'
Error

Line: 72 Column: 27

                      return s

    def _is_string(s):
        return type(s) is unicode

    def _string_result(s):
        return s

            

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.

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

Line: 38 Column: 1

              # to hide the differences from the main code.

# all bits on or off, expressed as a bytes type
x00 = b'\x00'
xff = b'\xff'
x00_entry = x00[0]
xff_entry = xff[0]
empty_pack = b''


            

Reported by Pylint.

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

Line: 39 Column: 1

              
# all bits on or off, expressed as a bytes type
x00 = b'\x00'
xff = b'\xff'
x00_entry = x00[0]
xff_entry = xff[0]
empty_pack = b''

_python3 = (sys.version_info >= (3, 0, 0))

            

Reported by Pylint.

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

Line: 40 Column: 1

              # all bits on or off, expressed as a bytes type
x00 = b'\x00'
xff = b'\xff'
x00_entry = x00[0]
xff_entry = xff[0]
empty_pack = b''

_python3 = (sys.version_info >= (3, 0, 0))
if _python3:

            

Reported by Pylint.

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

Line: 41 Column: 1

              x00 = b'\x00'
xff = b'\xff'
x00_entry = x00[0]
xff_entry = xff[0]
empty_pack = b''

_python3 = (sys.version_info >= (3, 0, 0))
if _python3:
    def _ord(b):

            

Reported by Pylint.

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

Line: 42 Column: 1

              xff = b'\xff'
x00_entry = x00[0]
xff_entry = xff[0]
empty_pack = b''

_python3 = (sys.version_info >= (3, 0, 0))
if _python3:
    def _ord(b):
        return b

            

Reported by Pylint.

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

Line: 46 Column: 5

              
_python3 = (sys.version_info >= (3, 0, 0))
if _python3:
    def _ord(b):
        return b

    def _chr(x, y=None):
        a = [x]
        if y != None:

            

Reported by Pylint.

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

Line: 49 Column: 5

                  def _ord(b):
        return b

    def _chr(x, y=None):
        a = [x]
        if y != None:
            a.append(y)
        return bytes(a)


            

Reported by Pylint.

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

Line: 49 Column: 5

                  def _ord(b):
        return b

    def _chr(x, y=None):
        a = [x]
        if y != None:
            a.append(y)
        return bytes(a)


            

Reported by Pylint.

src/third_party/wiredtiger/lang/python/wiredtiger/packing.py
24 issues
Unable to import 'wiredtiger.packutil'
Error

Line: 52 Column: 1

                u     bytes   raw byte array
"""

from wiredtiger.packutil import _chr, _is_string, _ord, _string_result, \
    empty_pack, x00
from wiredtiger.intpacking import pack_int, unpack_int

def __get_type(fmt):
    if not fmt:

            

Reported by Pylint.

Unable to import 'wiredtiger.intpacking'
Error

Line: 54 Column: 1

              
from wiredtiger.packutil import _chr, _is_string, _ord, _string_result, \
    empty_pack, x00
from wiredtiger.intpacking import pack_int, unpack_int

def __get_type(fmt):
    if not fmt:
        return None, fmt
    # Variable-sized encoding is the default (and only supported format in v1)

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 121 Column: 17

                          s = s[1:]
        elif f in 'Bb':
            # byte type
            for i in range(size):
                v = _ord(s[0])
                if f != 'B':
                    v -= 0x80
                result.append(v)
                s = s[1:]

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 129 Column: 17

                              s = s[1:]
        else:
            # integral type
            for j in range(size):
                v, s = unpack_int(s)
                result.append(v)
    return result

def __pack_iter_fmt(fmt, values):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 144 Column: 17

                          index += 1
        else:            # integral type
            size = size if havesize else 1
            for i in range(size):
                value = values[index]
                yield offset, havesize, 1, char, value
                index = index + 1

def pack(fmt, *values):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 156 Column: 5

                  if tfmt != '.':
        raise ValueError('Only variable-length encoding is currently supported')
    result = empty_pack
    i = 0
    for offset, havesize, size, f, val in __pack_iter_fmt(fmt, values):
        if f == 'x':
            if not havesize:
                result += x00
            else:

            

Reported by Pylint.

Too many branches (20/12)
Error

Line: 81 Column: 1

                          size = 0
            havesize = 0

def unpack(fmt, s):
    tfmt, fmt = __get_type(fmt)
    if not fmt:
        return ()
    if tfmt != '.':
        raise ValueError('Only variable-length encoding is currently supported')

            

Reported by Pylint.

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

Line: 81 Column: 1

                          size = 0
            havesize = 0

def unpack(fmt, s):
    tfmt, fmt = __get_type(fmt)
    if not fmt:
        return ()
    if tfmt != '.':
        raise ValueError('Only variable-length encoding is currently supported')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 81 Column: 1

                          size = 0
            havesize = 0

def unpack(fmt, s):
    tfmt, fmt = __get_type(fmt)
    if not fmt:
        return ()
    if tfmt != '.':
        raise ValueError('Only variable-length encoding is currently supported')

            

Reported by Pylint.

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

Line: 88 Column: 33

                  if tfmt != '.':
        raise ValueError('Only variable-length encoding is currently supported')
    result = []
    for offset, havesize, size, f in __unpack_iter_fmt(fmt):
        if f == 'x':
            s = s[size:]
            # Note: no value, don't increment i
        elif f in 'SsUu':
            if not havesize:

            

Reported by Pylint.