The following issues were found

src/third_party/zstandard-1.4.4/zstd/tests/test-zstd-versions.py
61 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 35
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

              

def execute(command, print_output=False, print_error=True, param_shell=False):
    popen = Popen(command, stdout=PIPE, stderr=PIPE, shell=param_shell)
    stdout_lines, stderr_lines = popen.communicate()
    stderr_lines = stderr_lines.decode("utf-8")
    stdout_lines = stdout_lines.decode("utf-8")
    if print_output:
        print(stdout_lines)

            

Reported by Bandit.

Unused variable 'stderr'
Error

Line: 67 Column: 13

              

def get_git_tags():
    stdout, stderr = git(['tag', '-l', 'v[0-9].[0-9].[0-9]'])
    tags = stdout.decode('utf-8').split()
    return tags


def create_dict(tag, dict_source_path):

            

Reported by Pylint.

Redefining name 'tags' from outer scope (line 216)
Error

Line: 68 Column: 5

              
def get_git_tags():
    stdout, stderr = git(['tag', '-l', 'v[0-9].[0-9].[0-9]'])
    tags = stdout.decode('utf-8').split()
    return tags


def create_dict(tag, dict_source_path):
    dict_name = 'dict.' + tag

            

Reported by Pylint.

Redefining name 'dict_source_path' from outer scope (line 202)
Error

Line: 72 Column: 22

                  return tags


def create_dict(tag, dict_source_path):
    dict_name = 'dict.' + tag
    if not os.path.isfile(dict_name):
        cFiles = glob.glob(dict_source_path + "/*.c")
        hFiles = glob.glob(dict_source_path + "/*.h")
        if tag == 'v0.5.0':

            

Reported by Pylint.

Redefining name 'tag' from outer scope (line 220)
Error

Line: 72 Column: 17

                  return tags


def create_dict(tag, dict_source_path):
    dict_name = 'dict.' + tag
    if not os.path.isfile(dict_name):
        cFiles = glob.glob(dict_source_path + "/*.c")
        hFiles = glob.glob(dict_source_path + "/*.h")
        if tag == 'v0.5.0':

            

Reported by Pylint.

Redefining name 'tag' from outer scope (line 220)
Error

Line: 89 Column: 26

                      print(dict_name + ' already exists')


def dict_compress_sample(tag, sample):
    dict_name = 'dict.' + tag
    DEVNULL = open(os.devnull, 'wb')
    if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-f',   sample], stderr=DEVNULL) == 0:
        os.rename(sample + '.zst', sample + '_01_64_' + tag + '_dictio.zst')
    if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-5f',  sample], stderr=DEVNULL) == 0:

            

Reported by Pylint.

Redefining name 'tag' from outer scope (line 220)
Error

Line: 107 Column: 21

                  print(tag + " : dict compression completed")


def compress_sample(tag, sample):
    DEVNULL = open(os.devnull, 'wb')
    if subprocess.call(['./zstd.' + tag, '-f',   sample], stderr=DEVNULL) == 0:
        os.rename(sample + '.zst', sample + '_01_64_' + tag + '_nodict.zst')
    if subprocess.call(['./zstd.' + tag, '-5f',  sample], stderr=DEVNULL) == 0:
        os.rename(sample + '.zst', sample + '_05_64_' + tag + '_nodict.zst')

            

Reported by Pylint.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 127
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

              # http://stackoverflow.com/a/19711609/2132223
def sha1_of_file(filepath):
    with open(filepath, 'rb') as f:
        return hashlib.sha1(f.read()).hexdigest()


def remove_duplicates():
    list_of_zst = sorted(glob.glob('*.zst'))
    for i, ref_zst in enumerate(list_of_zst):

            

Reported by Bandit.

Redefining name 'tag' from outer scope (line 220)
Error

Line: 144 Column: 20

                              print('duplicated : {} == {}'.format(ref_zst, compared_zst))


def decompress_zst(tag):
    dec_error = 0
    list_zst = sorted(glob.glob('*_nodict.zst'))
    for file_zst in list_zst:
        print(file_zst, end=' ')
        print(tag, end=' ')

            

Reported by Pylint.

Redefining name 'tag' from outer scope (line 220)
Error

Line: 167 Column: 21

                  return dec_error


def decompress_dict(tag):
    dec_error = 0
    list_zst = sorted(glob.glob('*_dictio.zst'))
    for file_zst in list_zst:
        dict_tag = file_zst[0:len(file_zst)-11]  # remove "_dictio.zst"
        if head in dict_tag: # find vdevel

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_timestamp22.py
60 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              #
# test_timestamp22.py
# Misuse the timestamp API, making sure we don't crash.
import wiredtiger, wttest, re, suite_random
from wtdataset import SimpleDataSet
from contextlib import contextmanager
from wtscenario import make_scenarios

class test_timestamp22(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 31 Column: 1

              #
# test_timestamp22.py
# Misuse the timestamp API, making sure we don't crash.
import wiredtiger, wttest, re, suite_random
from wtdataset import SimpleDataSet
from contextlib import contextmanager
from wtscenario import make_scenarios

class test_timestamp22(wttest.WiredTigerTestCase):

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 85 Column: 9

                          else:
                yield
            got = self.SUCCESS
        except:
            got = self.FAILURE
            self.cleanStderr()

        message += ' got ' + got


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 96 Column: 9

                          message += ': ERROR expected ' + expected
            self.checkStderr()
        self.pr(message)
        self.assertEquals(expected, got)

    # Create a predictable value based on the iteration number and timestamp.
    def gen_value(self, iternum, ts):
        return str(iternum) + '_' + str(ts) + '_' + 'x' * 1000


            

Reported by Pylint.

Attribute 'commit_value' defined outside __init__
Error

Line: 290 Column: 25

                                  self.report('commit_transaction', commit_config)
                    with self.expect(ok_commit, 'commit'):
                        session.commit_transaction(commit_config)
                        self.commit_value = value
                if needs_rollback:
                    # Rollback this one transaction, and continue the loop
                    self.report('rollback_transaction')
                    needs_rollback = False
                    session.rollback_transaction()

            

Reported by Pylint.

Unused argument 'stable'
Error

Line: 303 Column: 45

                          raise e
        cursor.close()

    def make_timestamp_config(self, oldest, stable, commit, durable):
        configs = []
        # Get list of 'oldest_timestamp=value' etc. that have non-negative values.
        for ts_name in ['oldest', 'stable', 'commit', 'durable']:
            val = eval(ts_name)
            if val >= 0:

            

Reported by Pylint.

Unused argument 'commit'
Error

Line: 303 Column: 53

                          raise e
        cursor.close()

    def make_timestamp_config(self, oldest, stable, commit, durable):
        configs = []
        # Get list of 'oldest_timestamp=value' etc. that have non-negative values.
        for ts_name in ['oldest', 'stable', 'commit', 'durable']:
            val = eval(ts_name)
            if val >= 0:

            

Reported by Pylint.

Unused argument 'durable'
Error

Line: 303 Column: 61

                          raise e
        cursor.close()

    def make_timestamp_config(self, oldest, stable, commit, durable):
        configs = []
        # Get list of 'oldest_timestamp=value' etc. that have non-negative values.
        for ts_name in ['oldest', 'stable', 'commit', 'durable']:
            val = eval(ts_name)
            if val >= 0:

            

Reported by Pylint.

Unused argument 'oldest'
Error

Line: 303 Column: 37

                          raise e
        cursor.close()

    def make_timestamp_config(self, oldest, stable, commit, durable):
        configs = []
        # Get list of 'oldest_timestamp=value' etc. that have non-negative values.
        for ts_name in ['oldest', 'stable', 'commit', 'durable']:
            val = eval(ts_name)
            if val >= 0:

            

Reported by Pylint.

Use of eval
Error

Line: 307 Column: 19

                      configs = []
        # Get list of 'oldest_timestamp=value' etc. that have non-negative values.
        for ts_name in ['oldest', 'stable', 'commit', 'durable']:
            val = eval(ts_name)
            if val >= 0:
                configs.append(ts_name + '_timestamp=' + self.timestamp_str(val))
        return ','.join(configs)

    # Determine whether we expect the set_timestamp to succeed.

            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_to_uint64.c
60 issues
Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 98 CWE codes: 758

                //  determine first the nr. of bits in x
  if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);

            

Reported by Cppcheck.

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

Line: 99 CWE codes: 758

                if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }

            

Reported by Cppcheck.

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

Line: 103 CWE codes: 758

                } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }
  q = bid_nr_digits[x_nr_bits - 1].digits;
  if (q == 0) {
    q = bid_nr_digits[x_nr_bits - 1].digits1;
    if (C1 >= bid_nr_digits[x_nr_bits - 1].threshold_lo)

            

Reported by Cppcheck.

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

Line: 139 CWE codes: 758

                    // <=> C * 10^(21-q) >= 0x9fffffffffffffffb, 1<=q<=16
      if (q == 1) {
	// C * 10^20 >= 0x9fffffffffffffffb
	__mul_128x64_to_128 (C, C1, bid_ten2k128[0]);	// 10^20 * C
	if (C.w[1] > 0x09 ||
	    (C.w[1] == 0x09 && C.w[0] >= 0xfffffffffffffffbull)) {
	  // set invalid flag
	  *pfpsf |= BID_INVALID_EXCEPTION;
	  // return Integer Indefinite

            

Reported by Cppcheck.

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

Line: 153 CWE codes: 758

                    } else {	// if (2 <= q <= 16) => 5 <= 21 - q <= 19
	// Note: C * 10^(21-q) has 20 or 21 digits; 0x9fffffffffffffffb 
	// has 21 digits
	__mul_64x64_to_128MACH (C, C1, bid_ten2k64[21 - q]);
	if (C.w[1] > 0x09 ||
	    (C.w[1] == 0x09 && C.w[0] >= 0xfffffffffffffffbull)) {
	  // set invalid flag
	  *pfpsf |= BID_INVALID_EXCEPTION;
	  // return Integer Indefinite

            

Reported by Cppcheck.

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

Line: 215 CWE codes: 758

                    // kx = 10^(-x) = bid_ten2mk64[ind - 1]
      // C* = (C1 + 1/2 * 10^x) * 10^(-x)
      // the approximation of 10^(-x) was rounded up to 54 bits
      __mul_64x64_to_128MACH (P128, C1, bid_ten2mk64[ind - 1]);
      Cstar = P128.w[1];
      fstar.w[1] = P128.w[1] & bid_maskhigh128[ind - 1];
      fstar.w[0] = P128.w[0];
      // the top Ex bits of 10^(-x) are T* = bid_ten2mk128trunc[ind].w[0], e.g.
      // if x=1, T*=bid_ten2mk128trunc[0].w[0]=0x1999999999999999

            

Reported by Cppcheck.

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

Line: 328 CWE codes: 758

                //  determine first the nr. of bits in x
  if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);

            

Reported by Cppcheck.

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

Line: 329 CWE codes: 758

                if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }

            

Reported by Cppcheck.

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

Line: 333 CWE codes: 758

                } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }
  q = bid_nr_digits[x_nr_bits - 1].digits;
  if (q == 0) {
    q = bid_nr_digits[x_nr_bits - 1].digits1;
    if (C1 >= bid_nr_digits[x_nr_bits - 1].threshold_lo)

            

Reported by Cppcheck.

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

Line: 369 CWE codes: 758

                    // <=> C * 10^(21-q) >= 0x9fffffffffffffffb, 1<=q<=16
      if (q == 1) {
	// C * 10^20 >= 0x9fffffffffffffffb
	__mul_128x64_to_128 (C, C1, bid_ten2k128[0]);	// 10^20 * C
	if (C.w[1] > 0x09 ||
	    (C.w[1] == 0x09 && C.w[0] >= 0xfffffffffffffffbull)) {
	  // set invalid flag
	  *pfpsf |= BID_INVALID_EXCEPTION;
	  // return Integer Indefinite

            

Reported by Cppcheck.

src/third_party/mozjs-60/extract/js/src/devtools/rootAnalysis/t/hazards/test.py
60 issues
Undefined variable 'test'
Error

Line: 1 Column: 1

              test.compile("source.cpp")
test.run_analysis_script('gcTypes')

# gcFunctions should be the inverse, but we get to rely on unmangled names here.
gcFunctions = test.load_gcFunctions()
print(gcFunctions)
assert('void GC()' in gcFunctions)
assert('void suppressedFunction()' not in gcFunctions)
assert('void halfSuppressedFunction()' in gcFunctions)

            

Reported by Pylint.

Undefined variable 'test'
Error

Line: 2 Column: 1

              test.compile("source.cpp")
test.run_analysis_script('gcTypes')

# gcFunctions should be the inverse, but we get to rely on unmangled names here.
gcFunctions = test.load_gcFunctions()
print(gcFunctions)
assert('void GC()' in gcFunctions)
assert('void suppressedFunction()' not in gcFunctions)
assert('void halfSuppressedFunction()' in gcFunctions)

            

Reported by Pylint.

Undefined variable 'test'
Error

Line: 5 Column: 15

              test.run_analysis_script('gcTypes')

# gcFunctions should be the inverse, but we get to rely on unmangled names here.
gcFunctions = test.load_gcFunctions()
print(gcFunctions)
assert('void GC()' in gcFunctions)
assert('void suppressedFunction()' not in gcFunctions)
assert('void halfSuppressedFunction()' in gcFunctions)
assert('void unsuppressedFunction()' in gcFunctions)

            

Reported by Pylint.

Undefined variable 'test'
Error

Line: 13 Column: 11

              assert('void unsuppressedFunction()' in gcFunctions)
assert('Cell* f()' in gcFunctions)

hazards = test.load_hazards()
hazmap = {haz.variable: haz for haz in hazards}
assert('cell1' not in hazmap)
assert('cell2' in hazmap)
assert('cell3' in hazmap)
assert('cell4' not in hazmap)

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 40 Column: 1

              assert(hazmap['<returnvalue>'].type == 'Cell*')

# loopy hazards. See comments in source.
assert('haz1' not in hazmap);
assert('haz2' not in hazmap);
assert('haz3' in hazmap);
assert('haz4' in hazmap);
assert('haz5' in hazmap);
assert('haz6' not in hazmap);

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 41 Column: 1

              
# loopy hazards. See comments in source.
assert('haz1' not in hazmap);
assert('haz2' not in hazmap);
assert('haz3' in hazmap);
assert('haz4' in hazmap);
assert('haz5' in hazmap);
assert('haz6' not in hazmap);
assert('haz7' not in hazmap);

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 42 Column: 1

              # loopy hazards. See comments in source.
assert('haz1' not in hazmap);
assert('haz2' not in hazmap);
assert('haz3' in hazmap);
assert('haz4' in hazmap);
assert('haz5' in hazmap);
assert('haz6' not in hazmap);
assert('haz7' not in hazmap);
assert('haz8' in hazmap);

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 43 Column: 1

              assert('haz1' not in hazmap);
assert('haz2' not in hazmap);
assert('haz3' in hazmap);
assert('haz4' in hazmap);
assert('haz5' in hazmap);
assert('haz6' not in hazmap);
assert('haz7' not in hazmap);
assert('haz8' in hazmap);

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 44 Column: 1

              assert('haz2' not in hazmap);
assert('haz3' in hazmap);
assert('haz4' in hazmap);
assert('haz5' in hazmap);
assert('haz6' not in hazmap);
assert('haz7' not in hazmap);
assert('haz8' in hazmap);

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 45 Column: 1

              assert('haz3' in hazmap);
assert('haz4' in hazmap);
assert('haz5' in hazmap);
assert('haz6' not in hazmap);
assert('haz7' not in hazmap);
assert('haz8' in hazmap);

            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_to_int64.c
60 issues
Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 98 CWE codes: 758

                //  determine first the nr. of bits in x
  if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);

            

Reported by Cppcheck.

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

Line: 99 CWE codes: 758

                if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }

            

Reported by Cppcheck.

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

Line: 103 CWE codes: 758

                } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }
  q = bid_nr_digits[x_nr_bits - 1].digits;
  if (q == 0) {
    q = bid_nr_digits[x_nr_bits - 1].digits1;
    if (C1 >= bid_nr_digits[x_nr_bits - 1].threshold_lo)

            

Reported by Cppcheck.

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

Line: 132 CWE codes: 758

                    // <=> 0.c(0)c(1)...c(q-1) * 10^20 > 0x50000000000000005, 1<=q<=16
      // <=> C * 10^(20-q) > 0x50000000000000005, 1<=q<=16
      // 1 <= q <= 16 => 4 <= 20-q <= 19 => 10^(20-q) is 64-bit, and so is C1
      __mul_64x64_to_128MACH (C, C1, bid_ten2k64[20 - q]);
      // Note: C1 * 10^(11-q) has 19 or 20 digits; 0x50000000000000005, has 20
      if (C.w[1] > 0x05ull || (C.w[1] == 0x05ull && C.w[0] > 0x05ull)) {
	// set invalid flag
	*pfpsf |= BID_INVALID_EXCEPTION;
	// return Integer Indefinite

            

Reported by Cppcheck.

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

Line: 152 CWE codes: 758

                    C.w[1] = 0x0000000000000004ull;
      C.w[0] = 0xfffffffffffffffbull;
      // 1 <= q <= 16 => 4 <= 20-q <= 19 => 10^(20-q) is 64-bit, and so is C1
      __mul_64x64_to_128MACH (C, C1, bid_ten2k64[20 - q]);
      if (C.w[1] > 0x04ull ||
	  (C.w[1] == 0x04ull && C.w[0] >= 0xfffffffffffffffbull)) {
	// set invalid flag
	*pfpsf |= BID_INVALID_EXCEPTION;
	// return Integer Indefinite

            

Reported by Cppcheck.

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

Line: 201 CWE codes: 758

                    // kx = 10^(-x) = bid_ten2mk64[ind - 1]
      // C* = (C1 + 1/2 * 10^x) * 10^(-x)
      // the approximation of 10^(-x) was rounded up to 54 bits
      __mul_64x64_to_128MACH (P128, C1, bid_ten2mk64[ind - 1]);
      Cstar = P128.w[1];
      fstar.w[1] = P128.w[1] & bid_maskhigh128[ind - 1];
      fstar.w[0] = P128.w[0];
      // the top Ex bits of 10^(-x) are T* = bid_ten2mk128trunc[ind].w[0], e.g.
      // if x=1, T*=bid_ten2mk128trunc[0].w[0]=0x1999999999999999

            

Reported by Cppcheck.

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

Line: 325 CWE codes: 758

                //  determine first the nr. of bits in x
  if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);

            

Reported by Cppcheck.

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

Line: 326 CWE codes: 758

                if (C1 >= 0x0020000000000000ull) {	// x >= 2^53
    // split the 64-bit value in two 32-bit halves to avoid rounding errors
    tmp1.d = (double) (C1 >> 32);	// exact conversion
    x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }

            

Reported by Cppcheck.

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

Line: 330 CWE codes: 758

                } else {	// if x < 2^53
    tmp1.d = (double) C1;	// exact conversion
    x_nr_bits =
      1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
  }
  q = bid_nr_digits[x_nr_bits - 1].digits;
  if (q == 0) {
    q = bid_nr_digits[x_nr_bits - 1].digits1;
    if (C1 >= bid_nr_digits[x_nr_bits - 1].threshold_lo)

            

Reported by Cppcheck.

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

Line: 359 CWE codes: 758

                    // <=> 0.c(0)c(1)...c(q-1) * 10^20 > 0x50000000000000005, 1<=q<=16
      // <=> C * 10^(20-q) > 0x50000000000000005, 1<=q<=16
      // 1 <= q <= 16 => 4 <= 20-q <= 19 => 10^(20-q) is 64-bit, and so is C1
      __mul_64x64_to_128MACH (C, C1, bid_ten2k64[20 - q]);
      // Note: C1 * 10^(11-q) has 19 or 20 digits; 0x50000000000000005, has 20
      if (C.w[1] > 0x05ull || (C.w[1] == 0x05ull && C.w[0] > 0x05ull)) {
	// set invalid flag
	*pfpsf |= BID_INVALID_EXCEPTION;
	// return Integer Indefinite

            

Reported by Cppcheck.

src/third_party/wiredtiger/test/3rdparty/extras-0.0.3/extras/tests/test_extras.py
59 issues
Unable to import 'testtools'
Error

Line: 3 Column: 1

              # Copyright (c) 2010-2012 extras developers. See LICENSE for details.

from testtools import TestCase
from testtools.matchers import (
    Equals,
    Is,
    Not,
    )


            

Reported by Pylint.

Unable to import 'testtools.matchers'
Error

Line: 4 Column: 1

              # Copyright (c) 2010-2012 extras developers. See LICENSE for details.

from testtools import TestCase
from testtools.matchers import (
    Equals,
    Is,
    Not,
    )


            

Reported by Pylint.

Attribute 'attribute' defined outside __init__
Error

Line: 54 Column: 9

                      class Foo(object):
            pass
        foo = Foo()
        foo.attribute = None
        self.assertEqual(True, safe_hasattr(foo, 'attribute'))

    def test_property_there(self):
        class Foo(object):
            @property

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 69 Column: 17

                      class Foo(object):
            @property
            def attribute(self):
                1/0
        foo = Foo()
        self.assertRaises(ZeroDivisionError, safe_hasattr, foo, 'attribute')


class TestTryImport(TestCase):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2010-2012 extras developers. See LICENSE for details.

from testtools import TestCase
from testtools.matchers import (
    Equals,
    Is,
    Not,
    )


            

Reported by Pylint.

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

Line: 28 Column: 5

                      ultimately be returned or not.
    """
    cb_calls = []
    def cb(e):
        test.assertIsInstance(e, ImportError)
        cb_calls.append(e)
    try:
        result = function(arg, error_callback=cb)
    except ImportError:

            

Reported by Pylint.

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

Line: 28 Column: 5

                      ultimately be returned or not.
    """
    cb_calls = []
    def cb(e):
        test.assertIsInstance(e, ImportError)
        cb_calls.append(e)
    try:
        result = function(arg, error_callback=cb)
    except ImportError:

            

Reported by Pylint.

Missing class docstring
Error

Line: 43 Column: 1

                  test.assertEquals(len(cb_calls), expected_error_count)


class TestSafeHasattr(TestCase):

    def test_attribute_not_there(self):
        class Foo(object):
            pass
        self.assertEqual(False, safe_hasattr(Foo(), 'anything'))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 45 Column: 5

              
class TestSafeHasattr(TestCase):

    def test_attribute_not_there(self):
        class Foo(object):
            pass
        self.assertEqual(False, safe_hasattr(Foo(), 'anything'))

    def test_attribute_there(self):

            

Reported by Pylint.

Class 'Foo' inherits from object, can be safely removed from bases in python3
Error

Line: 46 Column: 9

              class TestSafeHasattr(TestCase):

    def test_attribute_not_there(self):
        class Foo(object):
            pass
        self.assertEqual(False, safe_hasattr(Foo(), 'anything'))

    def test_attribute_there(self):
        class Foo(object):

            

Reported by Pylint.

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

Line: 34 Column: 1

              import SCons.Errors
import SCons.Util

from .common import debug, \
                   get_output, \
                   is_win64, \
                   normalize_env, \
                   parse_output, \
                   read_reg

            

Reported by Pylint.

Instance of 'VisualStudio' has no 'batch_file_path' member
Error

Line: 60 Column: 43

                      if not vs_dir:
            debug('find_executable():  no vs_dir')
            return None
        batch_file = os.path.join(vs_dir, self.batch_file_path)
        batch_file = os.path.normpath(batch_file)
        if not os.path.isfile(batch_file):
            debug('find_batch_file():  %s not on file system' % batch_file)
            return None
        return batch_file

            

Reported by Pylint.

Instance of 'VisualStudio' has no 'vc_version' member
Error

Line: 69 Column: 51

              
    def find_vs_dir_by_vc(self):
        SCons.Tool.MSCommon.vc.get_installed_vcs()
        dir = SCons.Tool.MSCommon.vc.find_vc_pdir(self.vc_version)
        if not dir:
            debug('find_vs_dir_by_vc():  no installed VC %s' % self.vc_version)
            return None
        return os.path.abspath(os.path.join(dir, os.pardir))


            

Reported by Pylint.

Instance of 'VisualStudio' has no 'vc_version' member
Error

Line: 71 Column: 64

                      SCons.Tool.MSCommon.vc.get_installed_vcs()
        dir = SCons.Tool.MSCommon.vc.find_vc_pdir(self.vc_version)
        if not dir:
            debug('find_vs_dir_by_vc():  no installed VC %s' % self.vc_version)
            return None
        return os.path.abspath(os.path.join(dir, os.pardir))

    def find_vs_dir_by_reg(self):
        root = 'Software\\'

            

Reported by Pylint.

Instance of 'VisualStudio' has no 'hkeys' member
Error

Line: 80 Column: 20

              
        if is_win64():
            root = root + 'Wow6432Node\\'
        for key in self.hkeys:
            if key=='use_dir':
                return self.find_vs_dir_by_vc()
            key = root + key
            try:
                comps = read_reg(key)

            

Reported by Pylint.

Instance of 'VisualStudio' has no 'executable_path' member
Error

Line: 109 Column: 43

                      if not vs_dir:
            debug('find_executable():  no vs_dir ({})'.format(vs_dir))
            return None
        executable = os.path.join(vs_dir, self.executable_path)
        executable = os.path.normpath(executable)
        if not os.path.isfile(executable):
            debug('find_executable():  {} not on file system'.format(executable))
            return None
        return executable

            

Reported by Pylint.

Instance of 'VisualStudio' has no 'supported_arch' member
Error

Line: 148 Column: 45

                      except KeyError:
            # RDEVE: for the time being use hardcoded lists
            # supported_arch = self.find_supported_arch()
            self._cache['supported_arch'] = self.supported_arch
            return self.supported_arch

    def reset(self):
        self._cache = {}


            

Reported by Pylint.

Instance of 'VisualStudio' has no 'supported_arch' member
Error

Line: 149 Column: 20

                          # RDEVE: for the time being use hardcoded lists
            # supported_arch = self.find_supported_arch()
            self._cache['supported_arch'] = self.supported_arch
            return self.supported_arch

    def reset(self):
        self._cache = {}

# The list of supported Visual Studio versions we know how to detect.

            

Reported by Pylint.

Using variable 'msvs' before assignment
Error

Line: 545 Column: 19

                  arch = get_default_arch(env)

def msvs_setup_env(env):
    batfilename = msvs.get_batch_file()
    msvs = get_vs_by_version(version)
    if msvs is None:
        return

    # XXX: I think this is broken. This will silently set a bogus tool instead

            

Reported by Pylint.

Undefined variable 'version'
Error

Line: 546 Column: 30

              
def msvs_setup_env(env):
    batfilename = msvs.get_batch_file()
    msvs = get_vs_by_version(version)
    if msvs is None:
        return

    # XXX: I think this is broken. This will silently set a bogus tool instead
    # of failing, but there is no other way with the current scons tool

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/GettextCommon.py
59 issues
Redefining name 'SCons' from outer scope (line 29)
Error

Line: 104 Column: 9

              
    def _create_node(self, name, factory, directory=None, create=1):
        """ Create node, and set it up to factory settings. """
        import SCons.Util
        node = factory(name, directory, create)
        node.set_noclean(self.noclean)
        node.set_precious(self.precious)
        if self.nodefault:
            self.env.Ignore('.', node)

            

Reported by Pylint.

Unused import SCons.Util
Error

Line: 104 Column: 9

              
    def _create_node(self, name, factory, directory=None, create=1):
        """ Create node, and set it up to factory settings. """
        import SCons.Util
        node = factory(name, directory, create)
        node.set_noclean(self.noclean)
        node.set_precious(self.precious)
        if self.nodefault:
            self.env.Ignore('.', node)

            

Reported by Pylint.

Redefining name 'SCons' from outer scope (line 29)
Error

Line: 133 Column: 5

              #############################################################################
def _read_linguas_from_files(env, linguas_files=None):
    """ Parse `LINGUAS` file and return list of extracted languages """
    import SCons.Util
    import SCons.Environment
    global _re_comment
    global _re_lang
    if not SCons.Util.is_List(linguas_files) \
            and not SCons.Util.is_String(linguas_files) \

            

Reported by Pylint.

Reimport 'SCons.Environment' (imported line 257)
Error

Line: 134 Column: 5

              def _read_linguas_from_files(env, linguas_files=None):
    """ Parse `LINGUAS` file and return list of extracted languages """
    import SCons.Util
    import SCons.Environment
    global _re_comment
    global _re_lang
    if not SCons.Util.is_List(linguas_files) \
            and not SCons.Util.is_String(linguas_files) \
            and not isinstance(linguas_files, SCons.Node.FS.Base) \

            

Reported by Pylint.

Using the global statement
Error

Line: 135 Column: 5

                  """ Parse `LINGUAS` file and return list of extracted languages """
    import SCons.Util
    import SCons.Environment
    global _re_comment
    global _re_lang
    if not SCons.Util.is_List(linguas_files) \
            and not SCons.Util.is_String(linguas_files) \
            and not isinstance(linguas_files, SCons.Node.FS.Base) \
            and linguas_files:

            

Reported by Pylint.

Using the global statement
Error

Line: 136 Column: 5

                  import SCons.Util
    import SCons.Environment
    global _re_comment
    global _re_lang
    if not SCons.Util.is_List(linguas_files) \
            and not SCons.Util.is_String(linguas_files) \
            and not isinstance(linguas_files, SCons.Node.FS.Base) \
            and linguas_files:
        # If, linguas_files==True or such, then read 'LINGUAS' file.

            

Reported by Pylint.

Redefining name 'SCons' from outer scope (line 29)
Error

Line: 225 Column: 9

                      The arguments and return value are same as for
        `SCons.Builder.BuilderBase._execute()`.
        """
        import SCons.Util
        import SCons.Node
        linguas_files = None
        if 'LINGUAS_FILE' in env and env['LINGUAS_FILE']:
            linguas_files = env['LINGUAS_FILE']
            # This prevents endless recursion loop (we'll be invoked once for

            

Reported by Pylint.

Keyword argument before variable positional arguments list in the definition of _translate function
Error

Line: 261 Column: 1

              

#############################################################################
def _translate(env, target=None, source=SCons.Environment._null, *args, **kw):
    """ Function for `Translate()` pseudo-builder """
    if target is None: target = []
    pot = env.POTUpdate(None, source, *args, **kw)
    po = env.POUpdate(target, pot, *args, **kw)
    return po

            

Reported by Pylint.

Access to a protected member _null of a client class
Error

Line: 261 Column: 41

              

#############################################################################
def _translate(env, target=None, source=SCons.Environment._null, *args, **kw):
    """ Function for `Translate()` pseudo-builder """
    if target is None: target = []
    pot = env.POTUpdate(None, source, *args, **kw)
    po = env.POUpdate(target, pot, *args, **kw)
    return po

            

Reported by Pylint.

FIXME: I'm not sure, how it should be implemented (what the *args are in
Error

Line: 329 Column: 3

                      """
        self.env = env

    # FIXME: I'm not sure, how it should be implemented (what the *args are in
    # general, what is **kw).
    def __call__(self, nodes, *args, **kw):
        """ Return nodes' paths (strings) relative to current working directory.

          **Arguments**:

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_truncate01.py
58 issues
Unable to import 'wiredtiger'
Error

Line: 37 Column: 1

              #       session level operations on tables
#

import wiredtiger, wttest
from helper import confirm_empty
from wtdataset import SimpleDataSet, ComplexDataSet, simple_key
from wtscenario import make_scenarios

# Test truncation arguments.

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 335 Column: 9

                      # begin and end: -1 means pass None for the cursor arg to truncate.  An
        # integer N, with 1 <= N < self.nentries, truncates from/to a cursor
        # positioned at that row.
        list = [
            (-1, self.nentries),                # begin to end, begin = None
            (1, -1),                            # begin to end, end = None
            (1, self.nentries),                 # begin to end
            (-1, self.nentries - self.skip),    # begin to middle, begin = None
            (1, self.nentries - self.skip),     # begin to middle

            

Reported by Pylint.

Unused variable 'total'
Error

Line: 355 Column: 9

                          value_format=self.valuefmt, config=self.config)

        # Build the layout we're going to test
        total = self.nentries
        for begin_skipped,begin_insert,end_skipped,end_insert in layout:

            # skipped records require insert/append records
            if begin_skipped and not begin_insert or \
                end_skipped and not end_insert:

            

Reported by Pylint.

String statement has no effect
Error

Line: 364 Column: 17

                              raise AssertionError('test error: skipped set without insert')

            for begin,end in list:
                '''
                print '===== run:'
                print 'key:', self.keyfmt, 'begin:', begin, 'end:', end
                print 'total: ', total, \
                    'begin_skipped:', begin_skipped, \
                    'begin_insert:', begin_insert, \

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 449 Column: 9

                      # begin and end: -1 means pass None for the cursor arg to truncate.  An
        # integer N, with 1 <= N < self.nentries, truncates from/to a cursor
        # positioned at that row.
        list = [
            (-1, self.nentries),                # begin to end, begin = None
            (1, -1),                            # begin to end, end = None
            (1, self.nentries),                 # begin to end
            (-1, self.nentries - self.skip),    # begin to middle, begin = None
            (1, self.nentries - self.skip),     # begin to middle

            

Reported by Pylint.

String statement has no effect
Error

Line: 466 Column: 13

              
        # Build the layout we're going to test
        for begin,end in list:
            '''
            print '===== run:', uri
            print 'key:', self.keyfmt, 'begin:', begin, 'end:', end
            '''

            # Create the object.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 37 Column: 1

              #       session level operations on tables
#

import wiredtiger, wttest
from helper import confirm_empty
from wtdataset import SimpleDataSet, ComplexDataSet, simple_key
from wtscenario import make_scenarios

# Test truncation arguments.

            

Reported by Pylint.

Missing class docstring
Error

Line: 43 Column: 1

              from wtscenario import make_scenarios

# Test truncation arguments.
class test_truncate_arguments(wttest.WiredTigerTestCase):
    name = 'test_truncate'

    scenarios = make_scenarios([
        ('file', dict(type='file:')),
        ('table', dict(type='table:'))

            

Reported by Pylint.

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

Line: 43 Column: 1

              from wtscenario import make_scenarios

# Test truncation arguments.
class test_truncate_arguments(wttest.WiredTigerTestCase):
    name = 'test_truncate'

    scenarios = make_scenarios([
        ('file', dict(type='file:')),
        ('table', dict(type='table:'))

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_cursor12.py
58 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import random, string, sys
import wiredtiger, wttest
from helper import copy_wiredtiger_home
from wtdataset import SimpleDataSet
from wtscenario import filter_scenarios, make_scenarios

# test_cursor12.py

            

Reported by Pylint.

Unused import sys
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 random, string, sys
import wiredtiger, wttest
from helper import copy_wiredtiger_home
from wtdataset import SimpleDataSet
from wtscenario import filter_scenarios, make_scenarios


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 225 Column: 13

                      for i in self.list:
            c.set_key(ds.key(row))
            c.set_value(self.make_value(i['o']))
            self.assertEquals(c.update(), 0)
            c.reset()

            self.session.begin_transaction("isolation=snapshot")
            c.set_key(ds.key(row))
            mods = []

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 235 Column: 13

                              mod = wiredtiger.Modify(j[0], j[1], j[2])
                mods.append(mod)
            mods = self.fix_mods(mods)
            self.assertEquals(c.modify(mods), 0)
            self.session.commit_transaction()
            c.reset()

            c.set_key(ds.key(row))
            self.assertEquals(c.search(), 0)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 240 Column: 13

                          c.reset()

            c.set_key(ds.key(row))
            self.assertEquals(c.search(), 0)
            v = c.get_value()
            expect = self.make_value(i['f'])
            self.assertEquals(self.nulls_to_spaces(v), expect)

            if not single:

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 243 Column: 13

                          self.assertEquals(c.search(), 0)
            v = c.get_value()
            expect = self.make_value(i['f'])
            self.assertEquals(self.nulls_to_spaces(v), expect)

            if not single:
                row = row + 1
        c.close()


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 257 Column: 13

                      c = self.session.open_cursor(self.uri, None)
        for i in self.list:
            c.set_key(ds.key(row))
            self.assertEquals(c.search(), 0)
            v = c.get_value()
            expect = self.make_value(i['f'])
            self.assertEquals(self.nulls_to_spaces(v), expect)

            if not single:

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 260 Column: 13

                          self.assertEquals(c.search(), 0)
            v = c.get_value()
            expect = self.make_value(i['f'])
            self.assertEquals(self.nulls_to_spaces(v), expect)

            if not single:
                row = row + 1
        c.close()


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 352 Column: 9

                      c.set_key(ds.key(10))
        orig = self.make_value('abcdefghijklmnopqrstuvwxyz')
        c.set_value(orig)
        self.assertEquals(c.update(), 0)
        for i in range(0, 50000):
            new = self.make_value("".join([random.choice(string.digits) \
                for i in range(5)]))
            orig = orig[:10] + new + orig[15:]
            mods = []

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 353 Column: 13

                      orig = self.make_value('abcdefghijklmnopqrstuvwxyz')
        c.set_value(orig)
        self.assertEquals(c.update(), 0)
        for i in range(0, 50000):
            new = self.make_value("".join([random.choice(string.digits) \
                for i in range(5)]))
            orig = orig[:10] + new + orig[15:]
            mods = []
            mod = wiredtiger.Modify(new, 10, 5)

            

Reported by Pylint.