The following issues were found
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_to_int64.c
100 issues
Line: 109
CWE codes:
758
if (C1.w[1] == 0) {
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits =
33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
Reported by Cppcheck.
Line: 111
CWE codes:
758
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits =
33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 115
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 120
CWE codes:
758
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((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.w[1] > bid_nr_digits[x_nr_bits - 1].threshold_hi
Reported by Cppcheck.
Line: 130
CWE codes:
758
&& C1.w[0] >= bid_nr_digits[x_nr_bits - 1].threshold_lo))
q++;
}
exp = (x_exp >> 49) - 6176;
if ((q + exp) > 19) { // x >= 10^19 ~= 2^63.11... (cannot fit in BID_SINT64)
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
res = 0x8000000000000000ull;
Reported by Cppcheck.
Line: 152
CWE codes:
758
C.w[0] = 0000000000000005ull;
if (q <= 19) { // 1 <= q <= 19 => 1 <= 20-q <= 19 =>
// 10^(20-q) is 64-bit, and so is C1
__mul_64x64_to_128MACH (C1, C1.w[0], bid_ten2k64[20 - q]);
} else if (q == 20) {
; // C1 * 10^0 = C1
} else { // if 21 <= q <= 34
__mul_128x64_to_128 (C, bid_ten2k64[q - 20], C); // max 47-bit x 67-bit
}
Reported by Cppcheck.
Line: 156
CWE codes:
758
} else if (q == 20) {
; // C1 * 10^0 = C1
} else { // if 21 <= q <= 34
__mul_128x64_to_128 (C, bid_ten2k64[q - 20], C); // max 47-bit x 67-bit
}
if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 176
CWE codes:
758
C.w[0] = 0xfffffffffffffffbull;
if (q <= 19) { // 1 <= q <= 19 => 1 <= 20-q <= 19 =>
// 10^(20-q) is 64-bit, and so is C1
__mul_64x64_to_128MACH (C1, C1.w[0], bid_ten2k64[20 - q]);
} else if (q == 20) {
; // C1 * 10^0 = C1
} else { // if 21 <= q <= 34
__mul_128x64_to_128 (C, bid_ten2k64[q - 20], C); // max 47-bit x 67-bit
}
Reported by Cppcheck.
Line: 180
CWE codes:
758
} else if (q == 20) {
; // C1 * 10^0 = C1
} else { // if 21 <= q <= 34
__mul_128x64_to_128 (C, bid_ten2k64[q - 20], C); // max 47-bit x 67-bit
}
if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 251
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 21) { // 0 <= ind - 1 <= 21
Cstar.w[1] = P256.w[3];
Cstar.w[0] = P256.w[2];
fstar.w[3] = 0;
fstar.w[2] = P256.w[2] & bid_maskhigh128[ind - 1];
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_to_int32.c
100 issues
Line: 108
CWE codes:
758
if (C1.w[1] == 0) {
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits =
33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
Reported by Cppcheck.
Line: 110
CWE codes:
758
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits =
33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 114
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 119
CWE codes:
758
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((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.w[1] > bid_nr_digits[x_nr_bits - 1].threshold_hi
Reported by Cppcheck.
Line: 129
CWE codes:
758
&& C1.w[0] >= bid_nr_digits[x_nr_bits - 1].threshold_lo))
q++;
}
exp = (x_exp >> 49) - 6176;
if ((q + exp) > 10) { // x >= 10^10 ~= 2^33.2... (cannot fit in 32 bits)
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
res = 0x80000000;
Reported by Cppcheck.
Line: 164
CWE codes:
758
// (scale 2^31+1/2 up)
tmp64 = 0x500000005ull;
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
// set invalid flag
Reported by Cppcheck.
Line: 166
CWE codes:
758
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 200
CWE codes:
758
// (scale 2^31-1/2 up)
tmp64 = 0x4fffffffbull;
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1]
|| (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
Reported by Cppcheck.
Line: 202
CWE codes:
758
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1]
|| (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
Reported by Cppcheck.
Line: 272
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 21) { // 0 <= ind - 1 <= 21
Cstar.w[1] = P256.w[3];
Cstar.w[0] = P256.w[2];
fstar.w[3] = 0;
fstar.w[2] = P256.w[2] & bid_maskhigh128[ind - 1];
Reported by Cppcheck.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/testcase.py
99 issues
Line: 24
Column: 1
import types
import unittest
from extras import (
safe_hasattr,
try_import,
)
from testtools import (
Reported by Pylint.
Line: 553
Column: 9
:raises ValueError: If the base class setUp is not called, a
ValueError is raised.
"""
ret = self.setUp()
if not self.__setup_called:
raise ValueError(
"In File: %s\n"
"TestCase.setUp was not called. Have you upcalled all the "
"way up the hierarchy from your setUp? e.g. Call "
Reported by Pylint.
Line: 571
Column: 9
:raises ValueError: If the base class tearDown is not called, a
ValueError is raised.
"""
ret = self.tearDown()
if not self.__teardown_called:
raise ValueError(
"In File: %s\n"
"TestCase.tearDown was not called. Have you upcalled all the "
"way up the hierarchy from your tearDown? e.g. Call "
Reported by Pylint.
Line: 777
Column: 16
"""
def id(self):
orig = super(WithAttributes, self).id()
# Depends on testtools.TestCase._get_test_method, be nice to support
# plain unittest.
fn = self._get_test_method()
attributes = getattr(fn, '__testtools_attrs', None)
if not attributes:
Reported by Pylint.
Line: 780
Column: 14
orig = super(WithAttributes, self).id()
# Depends on testtools.TestCase._get_test_method, be nice to support
# plain unittest.
fn = self._get_test_method()
attributes = getattr(fn, '__testtools_attrs', None)
if not attributes:
return orig
return orig + '[' + ','.join(sorted(attributes)) + ']'
Reported by Pylint.
Line: 21
Column: 1
import copy
import itertools
import sys
import types
import unittest
from extras import (
safe_hasattr,
try_import,
Reported by Pylint.
Line: 114
Column: 9
def decorator(function):
# Set an attribute on 'function' which will inform TestCase how to
# make the runner.
function._run_test_with = (
lambda case, handlers=None:
test_runner(case, handlers=handlers, **kwargs))
return function
return decorator
Reported by Pylint.
Line: 279
Column: 5
className = ', '.join(klass.__name__ for klass in classOrIterable)
return className
def addCleanup(self, function, *arguments, **keywordArguments):
"""Add a cleanup function to be called after tearDown.
Functions added with addCleanup will be called in reverse order of
adding after tearDown, or after setUp if setUp raises an exception.
Reported by Pylint.
Line: 316
Column: 5
def _add_reason(self, reason):
self.addDetail('reason', content.text_content(reason))
def assertEqual(self, expected, observed, message=''):
"""Assert that 'expected' is equal to 'observed'.
:param expected: The expected value.
:param observed: The observed value.
:param message: An optional message to include in the error.
Reported by Pylint.
Line: 328
Column: 5
failUnlessEqual = assertEquals = assertEqual
def assertIn(self, needle, haystack):
"""Assert that needle is in haystack."""
self.assertThat(haystack, Contains(needle))
def assertIsNone(self, observed, message=''):
"""Assert that 'observed' is equal to None.
Reported by Pylint.
src/third_party/wiredtiger/bench/workgen/runner/insert_test.py
96 issues
Line: 31
Column: 1
#
from runner import *
from wiredtiger import *
from workgen import *
def tablename(id):
return "table:test%06d" % id
Reported by Pylint.
Line: 32
Column: 1
from runner import *
from wiredtiger import *
from workgen import *
def tablename(id):
return "table:test%06d" % id
def show(tname):
Reported by Pylint.
Line: 57
Column: 11
if not gotit:
raise Exception("missing expected exception")
context = Context()
conn = context.wiredtiger_open("create,cache_size=1G")
s = conn.open_session()
tname0 = tablename(0)
tname1 = tablename(1)
s.create(tname0, 'key_format=S,value_format=S')
Reported by Pylint.
Line: 65
Column: 38
s.create(tname0, 'key_format=S,value_format=S')
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
Line: 65
Column: 53
s.create(tname0, 'key_format=S,value_format=S')
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
Line: 65
Column: 57
s.create(tname0, 'key_format=S,value_format=S')
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
Line: 65
Column: 7
s.create(tname0, 'key_format=S,value_format=S')
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
Line: 65
Column: 17
s.create(tname0, 'key_format=S,value_format=S')
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
Line: 65
Column: 81
s.create(tname0, 'key_format=S,value_format=S')
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
Line: 66
Column: 30
s.create(tname1, 'key_format=S,value_format=S')
ops = Operation(Operation.OP_INSERT, Table(tname0), Key(Key.KEYGEN_APPEND, 10), Value(100))
workload = Workload(context, Thread(ops))
print('RUN1')
workload.run(conn)
show(tname0)
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_to_uint32.c
96 issues
Line: 109
CWE codes:
758
if (C1.w[1] == 0) {
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 110
CWE codes:
758
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 114
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 119
CWE codes:
758
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((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.w[1] > bid_nr_digits[x_nr_bits - 1].threshold_hi
Reported by Cppcheck.
Line: 129
CWE codes:
758
&& C1.w[0] >= bid_nr_digits[x_nr_bits - 1].threshold_lo))
q++;
}
exp = (x_exp >> 49) - 6176;
if ((q + exp) > 10) { // x >= 10^10 ~= 2^33.2... (cannot fit in 32 bits)
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
res = 0x80000000;
Reported by Cppcheck.
Line: 164
CWE codes:
758
// (scale 1/2 up)
tmp64 = 0x05ull;
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
// set invalid flag
Reported by Cppcheck.
Line: 166
CWE codes:
758
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
// return Integer Indefinite
Reported by Cppcheck.
Line: 200
CWE codes:
758
// (scale 2^32-1/2 up)
tmp64 = 0x9fffffffbull;
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1]
|| (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
Reported by Cppcheck.
Line: 202
CWE codes:
758
if (q - 11 <= 19) { // 1 <= q - 11 <= 19; 10^(q-11) requires 64 bits
__mul_64x64_to_128MACH (C, tmp64, bid_ten2k64[q - 11]);
} else { // 20 <= q - 11 <= 23, and 10^(q-11) requires 128 bits
__mul_128x64_to_128 (C, tmp64, bid_ten2k128[q - 31]);
}
if (C1.w[1] > C.w[1]
|| (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
// set invalid flag
*pfpsf |= BID_INVALID_EXCEPTION;
Reported by Cppcheck.
Line: 283
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 21) { // 0 <= ind - 1 <= 21
Cstar.w[1] = P256.w[3];
Cstar.w[0] = P256.w[2];
fstar.w[3] = 0;
fstar.w[2] = P256.w[2] & bid_maskhigh128[ind - 1];
Reported by Cppcheck.
src/third_party/wiredtiger/bench/workgen/runner/runner/core.py
96 issues
Line: 32
Column: 1
# runner/core.py
# Core functions available to all runners
import glob, os, random
from workgen import Key, Operation, OpList, Table, Transaction, Value
# txn --
# Put the operation (and any suboperations) within a transaction.
def txn(op, config=None):
t = Transaction()
Reported by Pylint.
Line: 32
Column: 1
# runner/core.py
# Core functions available to all runners
import glob, os, random
from workgen import Key, Operation, OpList, Table, Transaction, Value
# txn --
# Put the operation (and any suboperations) within a transaction.
def txn(op, config=None):
t = Transaction()
Reported by Pylint.
Line: 39
Column: 9
def txn(op, config=None):
t = Transaction()
if config != None:
t._begin_config = config
op.transaction = t
return op
# sleep --
# Create an operation to sleep a given number of seconds.
Reported by Pylint.
Line: 51
Column: 8
# timed --
# Configure the operation (and suboperations) to run until the time elapses.
def timed(seconds, op):
if op._group == None:
result = Operation()
result._group = OpList([op])
result._repeatgroup = 1
else:
result = op
Reported by Pylint.
Line: 53
Column: 9
def timed(seconds, op):
if op._group == None:
result = Operation()
result._group = OpList([op])
result._repeatgroup = 1
else:
result = op
result._timed = seconds
return result
Reported by Pylint.
Line: 54
Column: 9
if op._group == None:
result = Operation()
result._group = OpList([op])
result._repeatgroup = 1
else:
result = op
result._timed = seconds
return result
Reported by Pylint.
Line: 57
Column: 5
result._repeatgroup = 1
else:
result = op
result._timed = seconds
return result
# Check for a local build that contains the wt utility. First check in
# current working directory, then in build_posix and finally in the disttop
# directory. This isn't ideal - if a user has multiple builds in a tree we
Reported by Pylint.
Line: 151
Column: 3
# Generally, the op._optype == Operation.OP_NONE, it indicates that
# the operation contains a group of subordinates.
#
# XXX
# Note that this function should be called for all iteration, rather than:
# for o in op._group
# because a bug in SWIG versions <= 2.0.11 would cause the above fragment
# to produce a segmentation violation as described here:
# https://sourceforge.net/p/swig/mailman/message/32838320/
Reported by Pylint.
Line: 158
Column: 17
# to produce a segmentation violation as described here:
# https://sourceforge.net/p/swig/mailman/message/32838320/
def _op_get_group_list(op):
grouplist = op._group
result = []
if grouplist != None:
result.extend(grouplist)
return result
Reported by Pylint.
Line: 168
Column: 8
# and/or key for each operation to a given value. It operates on the current operation,
# and recursively on any in its groiup list.
def _op_copy_mod(op, table, key):
if op._optype != Operation.OP_NONE:
if table != None:
op._table = table
if key != None:
op._key = key
if op._group != None:
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/abseil.podspec.gen.py
94 issues
Line: 93
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
"""Runs bazel query on given package file and returns all cc rules."""
result = subprocess.check_output(
["bazel", "query", package + ":all", "--output", "xml"])
root = xml.etree.ElementTree.fromstring(result)
return [
parse_rule(elem, package)
for elem in root
if elem.tag == "rule" and elem.attrib["class"].startswith("cc_")
]
Reported by Bandit.
Line: 15
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import collections
import os
import re
import subprocess
import xml.etree.ElementTree
# Template of root podspec.
SPEC_TEMPLATE = """
# This file has been automatically generated from a script.
Reported by Bandit.
Line: 16
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b405-import-xml-etree
import os
import re
import subprocess
import xml.etree.ElementTree
# Template of root podspec.
SPEC_TEMPLATE = """
# This file has been automatically generated from a script.
# Please make modifications to `abseil.podspec.gen.py` instead.
Reported by Bandit.
Line: 55
Column: 1
def get_elem_value(elem, name):
"""Returns the value of XML element with the given name."""
for child in elem:
if child.attrib.get("name") != name:
continue
if child.tag == "string":
return child.attrib.get("value")
Reported by Pylint.
Line: 56
Column: 1
def get_elem_value(elem, name):
"""Returns the value of XML element with the given name."""
for child in elem:
if child.attrib.get("name") != name:
continue
if child.tag == "string":
return child.attrib.get("value")
if child.tag == "boolean":
Reported by Pylint.
Line: 57
Column: 1
def get_elem_value(elem, name):
"""Returns the value of XML element with the given name."""
for child in elem:
if child.attrib.get("name") != name:
continue
if child.tag == "string":
return child.attrib.get("value")
if child.tag == "boolean":
return child.attrib.get("value") == "true"
Reported by Pylint.
Line: 58
Column: 1
"""Returns the value of XML element with the given name."""
for child in elem:
if child.attrib.get("name") != name:
continue
if child.tag == "string":
return child.attrib.get("value")
if child.tag == "boolean":
return child.attrib.get("value") == "true"
if child.tag == "list":
Reported by Pylint.
Line: 59
Column: 1
for child in elem:
if child.attrib.get("name") != name:
continue
if child.tag == "string":
return child.attrib.get("value")
if child.tag == "boolean":
return child.attrib.get("value") == "true"
if child.tag == "list":
return [nested_child.attrib.get("value") for nested_child in child]
Reported by Pylint.
Line: 60
Column: 1
if child.attrib.get("name") != name:
continue
if child.tag == "string":
return child.attrib.get("value")
if child.tag == "boolean":
return child.attrib.get("value") == "true"
if child.tag == "list":
return [nested_child.attrib.get("value") for nested_child in child]
raise "Cannot recognize tag: " + child.tag
Reported by Pylint.
Line: 61
Column: 1
continue
if child.tag == "string":
return child.attrib.get("value")
if child.tag == "boolean":
return child.attrib.get("value") == "true"
if child.tag == "list":
return [nested_child.attrib.get("value") for nested_child in child]
raise "Cannot recognize tag: " + child.tag
return None
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/intelc.py
94 issues
Line: 487
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html
(repr(version), linux_ver_normalize(version),abi,topdir,bindir))
if is_linux:
# Show the actual compiler version by running the compiler.
os.system('%s/%s/icc --version'%(topdir,bindir))
if is_mac:
# Show the actual compiler version by running the compiler.
os.system('%s/%s/icc --version'%(topdir,bindir))
env['INTEL_C_COMPILER_TOP'] = topdir
Reported by Bandit.
Line: 490
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html
os.system('%s/%s/icc --version'%(topdir,bindir))
if is_mac:
# Show the actual compiler version by running the compiler.
os.system('%s/%s/icc --version'%(topdir,bindir))
env['INTEL_C_COMPILER_TOP'] = topdir
if is_linux:
paths={'INCLUDE' : 'include',
'LIB' : libdir,
Reported by Bandit.
Line: 37
Column: 1
__revision__ = "src/engine/SCons/Tool/intelc.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import math, sys, os.path, glob, string, re
is_windows = sys.platform == 'win32'
is_win64 = is_windows and (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or
('PROCESSOR_ARCHITEW6432' in os.environ and
os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64'))
Reported by Pylint.
Line: 72
Column: 3
Always returns an old-style float like 80 or 90 for compatibility with Windows.
Shades of Y2K!"""
# Check for version number like 9.1.026: return 91.026
# XXX needs to be updated for 2011+ versions (like 2011.11.344 which is compiler v12.1.5)
m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', vstr)
if m:
vmaj,vmin,build = m.groups()
return float(vmaj) * 10. + float(vmin) + float(build) / 1000.
else:
Reported by Pylint.
Line: 112
Column: 9
try:
abi = valid_abis[abi]
except KeyError:
raise SCons.Errors.UserError("Intel compiler: Invalid ABI %s, valid values are %s"% \
(abi, list(valid_abis.keys())))
return abi
def get_version_from_list(v, vlist):
"""See if we can match v (string) in vlist (list of strings)
Reported by Pylint.
Line: 176
Column: 17
v = SCons.Util.RegQueryValueEx(k, valuename)[0]
return v # or v.encode('iso-8859-1', 'replace') to remove unicode?
except SCons.Util.RegError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
except SCons.Util.RegError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
except SCons.Util.WinError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
Reported by Pylint.
Line: 179
Column: 13
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
except SCons.Util.RegError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
except SCons.Util.WinError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
# Get the value:
try:
Reported by Pylint.
Line: 181
Column: 13
except SCons.Util.RegError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
except SCons.Util.WinError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
# Get the value:
try:
v = SCons.Util.RegQueryValueEx(k, valuename)[0]
return v # or v.encode('iso-8859-1', 'replace') to remove unicode?
Reported by Pylint.
Line: 188
Column: 9
v = SCons.Util.RegQueryValueEx(k, valuename)[0]
return v # or v.encode('iso-8859-1', 'replace') to remove unicode?
except SCons.Util.RegError:
raise MissingRegistryError("%s\\%s was not found in the registry."%(K, valuename))
def get_all_compiler_versions():
"""Returns a sorted list of strings, like "70" or "80" or "9.0"
with most recent compiler version first.
Reported by Pylint.
Line: 243
Column: 21
# Registry points to nonexistent dir. Ignore this
# version.
value = get_intel_registry_value('ProductDir', subkey, 'IA32')
except MissingRegistryError as e:
# Registry key is left dangling (potentially
# after uninstalling).
print("scons: *** Ignoring the registry key for the Intel compiler version %s.\n" \
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/dblite.py
92 issues
Line: 158
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html
# unlink() the file if the directory's writable, though, so ignore
# any OSError exception thrown by the chmod() call.
try:
self._os_chmod(self._file_name, 0o777)
except OSError:
pass
self._os_unlink(self._file_name)
self._os_rename(self._tmp_name, self._file_name)
if self._os_chown is not None and self._chown_to > 0: # don't chown to root or -1
Reported by Bandit.
Line: 111
Column: 13
self._chgrp_to = -1 # don't chgrp
if self._flag == "n":
with self._open(self._file_name, "wb", self._mode):
pass # just make sure it exists
else:
try:
f = self._open(self._file_name, "rb")
except IOError as e:
Reported by Pylint.
Line: 111
Column: 18
self._chgrp_to = -1 # don't chgrp
if self._flag == "n":
with self._open(self._file_name, "wb", self._mode):
pass # just make sure it exists
else:
try:
f = self._open(self._file_name, "rb")
except IOError as e:
Reported by Pylint.
Line: 119
Column: 17
except IOError as e:
if self._flag != "c":
raise e
with self._open(self._file_name, "wb", self._mode):
pass # just make sure it exists
else:
p = f.read()
f.close()
if len(p) > 0:
Reported by Pylint.
Line: 119
Column: 22
except IOError as e:
if self._flag != "c":
raise e
with self._open(self._file_name, "wb", self._mode):
pass # just make sure it exists
else:
p = f.read()
f.close()
if len(p) > 0:
Reported by Pylint.
Line: 122
Column: 21
with self._open(self._file_name, "wb", self._mode):
pass # just make sure it exists
else:
p = f.read()
f.close()
if len(p) > 0:
try:
if bytes is not str:
self._dict = pickle.loads(p, encoding='bytes')
Reported by Pylint.
Line: 147
Column: 13
def sync(self):
self._check_writable()
f = self._open(self._tmp_name, "wb", self._mode)
self._pickle_dump(self._dict, f, self._pickle_protocol)
f.close()
# Windows doesn't allow renaming if the file exists, so unlink
# it first, chmod'ing it to make sure we can do so. On UNIX, we
Reported by Pylint.
Line: 170
Column: 13
pass
self._needs_sync = 00000
if (keep_all_files):
self._shutil_copyfile(
self._file_name,
self._file_name + "_" + str(int(self._time_time())))
def _check_writable(self):
if (self._flag == "r"):
Reported by Pylint.
Line: 263
Column: 5
assert len(db) == 0
dblite._open("tmp.dblite", "w")
db = open("tmp", "r")
dblite._open("tmp.dblite", "w").write("x")
try:
db = open("tmp", "r")
except pickle.UnpicklingError:
pass
else:
Reported by Pylint.
Line: 42
Column: 3
dblite_suffix = '.dblite'
# TODO: Does commenting this out break switching from py2/3?
# if bytes is not str:
# dblite_suffix += '.p3'
tmp_suffix = '.tmp'
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/jit/Recover.cpp
91 issues
Line: 165
Column: 34
CWE codes:
120
20
bool
RBitNot::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue operand(cx, iter.read());
int32_t result;
if (!js::BitNot(cx, operand, &result))
return false;
Reported by FlawFinder.
Line: 190
Column: 30
CWE codes:
120
20
bool
RBitAnd::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitAnd(cx, lhs, rhs, &result))
Reported by FlawFinder.
Line: 191
Column: 30
CWE codes:
120
20
RBitAnd::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitAnd(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 217
Column: 30
CWE codes:
120
20
bool
RBitOr::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitOr(cx, lhs, rhs, &result))
Reported by FlawFinder.
Line: 218
Column: 30
CWE codes:
120
20
RBitOr::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitOr(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 244
Column: 30
CWE codes:
120
20
bool
RBitXor::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
if (!js::BitXor(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 245
Column: 30
CWE codes:
120
20
RBitXor::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
if (!js::BitXor(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 270
Column: 30
CWE codes:
120
20
bool
RLsh::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitLsh(cx, lhs, rhs, &result))
Reported by FlawFinder.
Line: 271
Column: 30
CWE codes:
120
20
RLsh::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
if (!js::BitLsh(cx, lhs, rhs, &result))
return false;
Reported by FlawFinder.
Line: 297
Column: 30
CWE codes:
120
20
bool
RRsh::recover(JSContext* cx, SnapshotIterator& iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
MOZ_ASSERT(!lhs.isObject() && !rhs.isObject());
int32_t result;
if (!js::BitRsh(cx, lhs, rhs, &result))
Reported by FlawFinder.