The following issues were found
src/third_party/wiredtiger/test/suite/helper.py
24 issues
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
Line: 27
Column: 1
from testtools.tests.helpers import FullStackRunTest
# Silence pyflakes.
Matcher
class TestMismatch(TestCase):
run_tests_with = FullStackRunTest
Reported by Pylint.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
Line: 72
Column: 27
return s
def _is_string(s):
return type(s) is unicode
def _string_result(s):
return s
Reported by Pylint.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.