The following issues were found
src/third_party/wiredtiger/test/suite/test_cursor11.py
35 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 make_scenarios
# test_cursor11.py
Reported by Pylint.
Line: 73
Column: 9
c = s.open_cursor(uri, None)
c.set_key(ds.key(25))
self.assertEquals(c.search(), 0)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(26))
c.remove()
self.assertEquals(c.get_key(), ds.key(26))
msg = '/requires value be set/'
Reported by Pylint.
Line: 74
Column: 9
c.set_key(ds.key(25))
self.assertEquals(c.search(), 0)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(26))
c.remove()
self.assertEquals(c.get_key(), ds.key(26))
msg = '/requires value be set/'
self.assertRaisesWithMessage(
Reported by Pylint.
Line: 75
Column: 9
c.set_key(ds.key(25))
self.assertEquals(c.search(), 0)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(26))
c.remove()
self.assertEquals(c.get_key(), ds.key(26))
msg = '/requires value be set/'
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_value, msg)
Reported by Pylint.
Line: 77
Column: 9
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(26))
c.remove()
self.assertEquals(c.get_key(), ds.key(26))
msg = '/requires value be set/'
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_value, msg)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(27))
Reported by Pylint.
Line: 81
Column: 9
msg = '/requires value be set/'
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_value, msg)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(27))
# Do a remove using the cursor without setting a position, and confirm
# no key, value or position remains.
def test_cursor_remove_without_position(self):
Reported by Pylint.
Line: 82
Column: 9
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_value, msg)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(27))
# Do a remove using the cursor without setting a position, and confirm
# no key, value or position remains.
def test_cursor_remove_without_position(self):
if self.skip():
Reported by Pylint.
Line: 105
Column: 9
msg = '/requires value be set/'
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_value, msg)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(1))
# Do a remove using the key after also setting a position, and confirm
# no key, value or position remains.
def test_cursor_remove_with_key_and_position(self):
Reported by Pylint.
Line: 106
Column: 9
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_value, msg)
self.assertEquals(c.next(), 0)
self.assertEquals(c.get_key(), ds.key(1))
# Do a remove using the key after also setting a position, and confirm
# no key, value or position remains.
def test_cursor_remove_with_key_and_position(self):
if self.skip():
Reported by Pylint.
Line: 122
Column: 9
c = s.open_cursor(uri, None)
c.set_key(ds.key(25))
self.assertEquals(c.search(), 0)
c.set_key(ds.key(25))
c.remove()
msg = '/requires key be set/'
self.assertRaisesWithMessage(
wiredtiger.WiredTigerError, c.get_key, msg)
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/container/internal/layout_test.cc
35 issues
Line: 88
static_assert(std::is_same<Expected, Actual>(), "");
}
TEST(Layout, ElementType) {
{
using L = Layout<int32_t>;
SameType<int32_t, L::ElementType<0>>();
SameType<int32_t, decltype(L::Partial())::ElementType<0>>();
SameType<int32_t, decltype(L::Partial(0))::ElementType<0>>();
Reported by Cppcheck.
Line: 369
Column: 39
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, PointerByIndex) {
alignas(max_align_t) const unsigned char p[100] = {};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<0>(p))));
EXPECT_EQ(0,
Distance(p, Type<const int32_t*>(L::Partial(3).Pointer<0>(p))));
Reported by FlawFinder.
Line: 450
Column: 39
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, PointerByType) {
alignas(max_align_t) const unsigned char p[100] = {};
{
using L = Layout<int32_t>;
EXPECT_EQ(
0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<int32_t>(p))));
EXPECT_EQ(
Reported by FlawFinder.
Line: 529
Column: 33
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, MutablePointerByIndex) {
alignas(max_align_t) unsigned char p[100];
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<0>(p))));
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial(3).Pointer<0>(p))));
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L(3).Pointer<0>(p))));
Reported by FlawFinder.
Line: 584
Column: 33
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, MutablePointerByType) {
alignas(max_align_t) unsigned char p[100];
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<int32_t>(p))));
EXPECT_EQ(0,
Distance(p, Type<int32_t*>(L::Partial(3).Pointer<int32_t>(p))));
Reported by FlawFinder.
Line: 650
Column: 39
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, Pointers) {
alignas(max_align_t) const unsigned char p[100] = {};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
EXPECT_EQ(std::make_tuple(x.Pointer<0>(p)),
Type<std::tuple<const int8_t*>>(x.Pointers(p)));
Reported by FlawFinder.
Line: 686
Column: 33
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, MutablePointers) {
alignas(max_align_t) unsigned char p[100];
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
EXPECT_EQ(std::make_tuple(x.Pointer<0>(p)),
Type<std::tuple<int8_t*>>(x.Pointers(p)));
Reported by FlawFinder.
Line: 719
Column: 39
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, SliceByIndexSize) {
alignas(max_align_t) const unsigned char p[100] = {};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
EXPECT_EQ(3, L::Partial(3).Slice<0>(p).size());
EXPECT_EQ(3, L(3).Slice<0>(p).size());
Reported by FlawFinder.
Line: 747
Column: 39
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, SliceByTypeSize) {
alignas(max_align_t) const unsigned char p[100] = {};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
EXPECT_EQ(3, L::Partial(3).Slice<int32_t>(p).size());
EXPECT_EQ(3, L(3).Slice<int32_t>(p).size());
Reported by FlawFinder.
Line: 769
Column: 33
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
TEST(Layout, MutableSliceByIndexSize) {
alignas(max_align_t) unsigned char p[100];
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
EXPECT_EQ(3, L::Partial(3).Slice<0>(p).size());
EXPECT_EQ(3, L(3).Slice<0>(p).size());
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_compress02.py
35 issues
Line: 32
Column: 1
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
# test_compress02.py
Reported by Pylint.
Line: 35
Column: 1
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
# test_compress02.py
# This test checks that the compression level can be reconfigured after restart if
# we are using zstd as the block compressor. Tables created before reconfiguration
# will still use the previous compression level.
Reported by Pylint.
Line: 47
Column: 5
uri = "table:test_compress02"
nrows = 1000
def conn_config(self):
config = 'builtin_extension_config={zstd={compression_level=6}},cache_size=10MB,log=(enabled=true)'
return config
def large_updates(self, uri, value, ds, nrows):
# Update a large number of records.
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_sqrt.c
35 issues
Line: 76
CWE codes:
758
res.w[1] =
sign_x |
((((BID_UINT64) (exponent_x + DECIMAL_EXPONENT_BIAS_128)) >> 1) << 49);
res.w[0] = 0;
BID_RETURN (res);
}
if (sign_x) {
res.w[1] = 0x7c00000000000000ull;
Reported by Cppcheck.
Line: 101
CWE codes:
758
A10 = CX;
if (exponent_x & 1) {
A10.w[1] = (CX.w[1] << 3) | (CX.w[0] >> 61);
A10.w[0] = CX.w[0] << 3;
CX2.w[1] = (CX.w[1] << 1) | (CX.w[0] >> 63);
CX2.w[0] = CX.w[0] << 1;
__add_128_128 (A10, A10, CX2);
}
Reported by Cppcheck.
Line: 103
CWE codes:
758
if (exponent_x & 1) {
A10.w[1] = (CX.w[1] << 3) | (CX.w[0] >> 61);
A10.w[0] = CX.w[0] << 3;
CX2.w[1] = (CX.w[1] << 1) | (CX.w[0] >> 63);
CX2.w[0] = CX.w[0] << 1;
__add_128_128 (A10, A10, CX2);
}
CS.w[0] = short_sqrt128 (A10);
Reported by Cppcheck.
Line: 112
CWE codes:
758
CS.w[1] = 0;
// check for exact result
if (CS.w[0] * CS.w[0] == A10.w[0]) {
__mul_64x64_to_128_fast (S2, CS.w[0], CS.w[0]);
if (S2.w[1] == A10.w[1]) // && S2.w[0]==A10.w[0])
{
bid_get_BID128_very_fast (&res, 0,
(exponent_x +
DECIMAL_EXPONENT_BIAS_128) >> 1, CS);
Reported by Cppcheck.
Line: 137
CWE codes:
758
if (scale > 38) {
T128 = bid_power10_table_128[scale - 37];
__mul_128x128_low (CX1, CX, T128);
TP128 = bid_power10_table_128[37];
__mul_128x128_to_256 (C256, CX1, TP128);
} else {
T128 = bid_power10_table_128[scale];
Reported by Cppcheck.
Line: 140
CWE codes:
758
__mul_128x128_low (CX1, CX, T128);
TP128 = bid_power10_table_128[37];
__mul_128x128_to_256 (C256, CX1, TP128);
} else {
T128 = bid_power10_table_128[scale];
__mul_128x128_to_256 (C256, CX, T128);
}
Reported by Cppcheck.
Line: 143
CWE codes:
758
__mul_128x128_to_256 (C256, CX1, TP128);
} else {
T128 = bid_power10_table_128[scale];
__mul_128x128_to_256 (C256, CX, T128);
}
// 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
Reported by Cppcheck.
Line: 148
CWE codes:
758
// 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
C4.w[2] = (C256.w[2] << 2) | (C256.w[1] >> 62);
C4.w[1] = (C256.w[1] << 2) | (C256.w[0] >> 62);
C4.w[0] = C256.w[0] << 2;
bid_long_sqrt128 (&CS, C256);
Reported by Cppcheck.
Line: 149
CWE codes:
758
// 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
C4.w[2] = (C256.w[2] << 2) | (C256.w[1] >> 62);
C4.w[1] = (C256.w[1] << 2) | (C256.w[0] >> 62);
C4.w[0] = C256.w[0] << 2;
bid_long_sqrt128 (&CS, C256);
//printf("C256=%016I64x %016I64x %016I64x %016I64x, CS=%016I64x %016I64x \n",C256.w[3],C256.w[2],C256.w[1],C256.w[0],CS.w[1],CS.w[0]);
Reported by Cppcheck.
Line: 150
CWE codes:
758
// 4*C256
C4.w[3] = (C256.w[3] << 2) | (C256.w[2] >> 62);
C4.w[2] = (C256.w[2] << 2) | (C256.w[1] >> 62);
C4.w[1] = (C256.w[1] << 2) | (C256.w[0] >> 62);
C4.w[0] = C256.w[0] << 2;
bid_long_sqrt128 (&CS, C256);
//printf("C256=%016I64x %016I64x %016I64x %016I64x, CS=%016I64x %016I64x \n",C256.w[3],C256.w[2],C256.w[1],C256.w[0],CS.w[1],CS.w[0]);
Reported by Cppcheck.
src/third_party/wiredtiger/test/suite/test_shared_cache02.py
35 issues
Line: 32
Column: 1
import os
import shutil
import wiredtiger, wttest
from wttest import unittest
# test_shared_cache02.py
# Shared cache tests
# Test shared cache shared amongst multiple connections.
Reported by Pylint.
Line: 147
Column: 5
# Test reconfigure that switches to using a shared cache
# previous reserve size isn't taken into account
def test_shared_cache_reconfig03(self):
nops = 1000
self.openConnections(['WT_TEST1', 'WT_TEST2'], pool_opts = ',')
for sess in self.sessions:
sess.create(self.uri, "key_format=S,value_format=S")
Reported by Pylint.
Line: 33
Column: 1
import os
import shutil
import wiredtiger, wttest
from wttest import unittest
# test_shared_cache02.py
# Shared cache tests
# Test shared cache shared amongst multiple connections.
class test_shared_cache02(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 55
Column: 5
def setUpSessionOpen(self, conn):
return None
def close_conn(self):
return None
def setUpConnectionOpen(self, dir):
return None
Reported by Pylint.
Line: 58
Column: 5
def close_conn(self):
return None
def setUpConnectionOpen(self, dir):
return None
def openConnections(
self,
connections,
Reported by Pylint.
Line: 58
Column: 35
def close_conn(self):
return None
def setUpConnectionOpen(self, dir):
return None
def openConnections(
self,
connections,
Reported by Pylint.
Line: 58
Column: 35
def close_conn(self):
return None
def setUpConnectionOpen(self, dir):
return None
def openConnections(
self,
connections,
Reported by Pylint.
Line: 68
Column: 13
extra_opts = '',
add=0):
if add == 0:
self.conns = []
self.sessions = []
# Open the set of connections.
for name in connections:
shutil.rmtree(name, True)
os.mkdir(name)
Reported by Pylint.
Line: 69
Column: 13
add=0):
if add == 0:
self.conns = []
self.sessions = []
# Open the set of connections.
for name in connections:
shutil.rmtree(name, True)
os.mkdir(name)
next_conn = self.wiredtiger_open(
Reported by Pylint.
Line: 85
Column: 9
def closeConnections(self):
for tmp_conn in self.conns:
tmp_conn.close()
self.conns = []
self.sessions = [] # Implicitly closed when closing sessions.
# Test reconfigure API
def test_shared_cache_reconfig01(self):
nops = 1000
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_util02.py
35 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios
# test_util02.py
Reported by Pylint.
Line: 109
Column: 22
"""
result = ''
if type(obj) == self.stringclass:
for c in s:
if hexoutput:
result += "%0.2x" % ord(c)
elif c == '\\':
result += '\\\\'
elif c == ' ' or \
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios
# test_util02.py
Reported by Pylint.
Line: 54
Column: 29
('ii', dict(key_format='i',value_format='i')),
])
def get_string(self, i, len):
"""
Return a pseudo-random, but predictable string that uses
all characters. As a special case, key 0 returns all characters
1-255 repeated
"""
Reported by Pylint.
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: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import string, os
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import ComplexDataSet
from wtscenario import make_scenarios
# test_util02.py
Reported by Pylint.
Line: 37
Column: 1
# test_util02.py
# Utilities: wt load
class test_util02(wttest.WiredTigerTestCase, suite_subprocess):
"""
Test wt load
"""
tablename = 'test_util02.a'
Reported by Pylint.
Line: 54
Column: 5
('ii', dict(key_format='i',value_format='i')),
])
def get_string(self, i, len):
"""
Return a pseudo-random, but predictable string that uses
all characters. As a special case, key 0 returns all characters
1-255 repeated
"""
Reported by Pylint.
src/third_party/wiredtiger/test/format/backup.c
34 issues
Line: 379
CWE codes:
775
testutil_die(errno, "restore_backup_info fopen: %s", path);
free(path);
if (errno == ENOENT)
return (RESTORE_SKIP);
ret = fscanf(fp, "%" SCNu64 "\n", &id);
if (ret != 1)
testutil_die(EINVAL, "restore_backup_info ID");
/*
* Try to open the backup cursor. We may get ENOENT if the source ID we wrote to the program
Reported by Cppcheck.
Line: 170
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
uint32_t curpos, prevpos;
int cmp;
char filename[1024];
if (prev == NULL)
return;
#if 0
active_files_print(prev, "computing removals: previous list of active files");
Reported by FlawFinder.
Line: 247
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
ssize_t rdsize;
uint64_t offset, size, this_size, total, type;
int rfd, wfd1, wfd2;
char config[512], *tmp;
bool first_pass;
tmp_sz = 0;
tmp = NULL;
first_pass = true;
Reported by FlawFinder.
Line: 269
Column: 39
CWE codes:
362
len = strlen(g.home) + strlen(name) + 10;
tmp = dmalloc(len);
testutil_check(__wt_snprintf(tmp, len, "%s/%s", g.home, name));
error_sys_check(rfd = open(tmp, O_RDONLY, 0644));
free(tmp);
tmp = NULL;
len = strlen(g.home) + strlen("BACKUP") + strlen(name) + 10;
tmp = dmalloc(len);
Reported by FlawFinder.
Line: 276
Column: 40
CWE codes:
362
len = strlen(g.home) + strlen("BACKUP") + strlen(name) + 10;
tmp = dmalloc(len);
testutil_check(__wt_snprintf(tmp, len, "%s/BACKUP/%s", g.home, name));
error_sys_check(wfd1 = open(tmp, O_WRONLY | O_CREAT, 0644));
free(tmp);
tmp = NULL;
len = strlen(g.home) + strlen("BACKUP.copy") + strlen(name) + 10;
tmp = dmalloc(len);
Reported by FlawFinder.
Line: 283
Column: 40
CWE codes:
362
len = strlen(g.home) + strlen("BACKUP.copy") + strlen(name) + 10;
tmp = dmalloc(len);
testutil_check(__wt_snprintf(tmp, len, "%s/BACKUP.copy/%s", g.home, name));
error_sys_check(wfd2 = open(tmp, O_WRONLY | O_CREAT, 0644));
free(tmp);
tmp = NULL;
first_pass = false;
}
Reported by FlawFinder.
Line: 367
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
size_t len;
uint64_t id;
uint32_t i;
char buf[512], *path;
testutil_assert(g.c_backup_incr_flag == INCREMENTAL_BLOCK);
len = strlen(g.home) + strlen(BACKUP_INFO_FILE) + 2;
path = dmalloc(len);
testutil_check(__wt_snprintf(path, len, "%s/%s", g.home, BACKUP_INFO_FILE));
Reported by FlawFinder.
Line: 375
Column: 15
CWE codes:
362
testutil_check(__wt_snprintf(path, len, "%s/%s", g.home, BACKUP_INFO_FILE));
errno = 0;
ret = RESTORE_SUCCESS;
if ((fp = fopen(path, "r")) == NULL && errno != ENOENT)
testutil_die(errno, "restore_backup_info fopen: %s", path);
free(path);
if (errno == ENOENT)
return (RESTORE_SKIP);
ret = fscanf(fp, "%" SCNu64 "\n", &id);
Reported by FlawFinder.
Line: 448
Column: 15
CWE codes:
362
len = strlen(g.home) + strlen(BACKUP_INFO_FILE_TMP) + 2;
from_path = dmalloc(len);
testutil_check(__wt_snprintf(from_path, len, "%s/%s", g.home, BACKUP_INFO_FILE_TMP));
if ((fp = fopen(from_path, "w")) == NULL)
testutil_die(errno, "save_backup_info fopen: %s", from_path);
fprintf(fp, "%" PRIu64 "\n", id);
if (active->count > 0) {
fprintf(fp, "%" PRIu32 "\n", active->count);
for (i = 0; i < active->count; ++i)
Reported by FlawFinder.
Line: 480
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
u_int incremental, period;
uint64_t src_id, this_id;
const char *config, *key;
char cfg[512];
bool full, incr_full;
(void)(arg);
conn = g.wts_conn;
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/jit/mips64/MacroAssembler-mips64.cpp
34 issues
Line: 1090
Column: 79
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssemblerMIPS64Compat::loadUnalignedDouble(const wasm::MemoryAccessDesc& access,
const BaseIndex& src, Register temp, FloatRegister dest)
{
computeScaledAddress(src, SecondScratchReg);
BufferOffset load;
if (Imm16::IsInSignedRange(src.offset) && Imm16::IsInSignedRange(src.offset + 7)) {
Reported by FlawFinder.
Line: 1104
Column: 12
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
load = as_ldl(temp, ScratchRegister, 7);
as_ldr(temp, ScratchRegister, 0);
}
append(access, load.getOffset(), asMasm().framePushed());
moveToDouble(temp, dest);
}
void
MacroAssemblerMIPS64Compat::loadUnalignedFloat32(const wasm::MemoryAccessDesc& access,
Reported by FlawFinder.
Line: 1109
Column: 80
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssemblerMIPS64Compat::loadUnalignedFloat32(const wasm::MemoryAccessDesc& access,
const BaseIndex& src, Register temp, FloatRegister dest)
{
computeScaledAddress(src, SecondScratchReg);
BufferOffset load;
if (Imm16::IsInSignedRange(src.offset) && Imm16::IsInSignedRange(src.offset + 3)) {
Reported by FlawFinder.
Line: 1123
Column: 12
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
load = as_lwl(temp, ScratchRegister, 3);
as_lwr(temp, ScratchRegister, 0);
}
append(access, load.getOffset(), asMasm().framePushed());
moveToFloat32(temp, dest);
}
void
MacroAssemblerMIPS64Compat::store8(Imm32 imm, const Address& address)
Reported by FlawFinder.
Line: 1261
Column: 81
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssemblerMIPS64Compat::storeUnalignedFloat32(const wasm::MemoryAccessDesc& access,
FloatRegister src, Register temp, const BaseIndex& dest)
{
computeScaledAddress(dest, SecondScratchReg);
moveFromFloat32(src, temp);
BufferOffset store;
Reported by FlawFinder.
Line: 1276
Column: 12
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
store = as_swl(temp, ScratchRegister, 3);
as_swr(temp, ScratchRegister, 0);
}
append(access, store.getOffset(), asMasm().framePushed());
}
void
MacroAssemblerMIPS64Compat::storeUnalignedDouble(const wasm::MemoryAccessDesc& access,
FloatRegister src, Register temp, const BaseIndex& dest)
Reported by FlawFinder.
Line: 1280
Column: 80
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssemblerMIPS64Compat::storeUnalignedDouble(const wasm::MemoryAccessDesc& access,
FloatRegister src, Register temp, const BaseIndex& dest)
{
computeScaledAddress(dest, SecondScratchReg);
moveFromDouble(src, temp);
Reported by FlawFinder.
Line: 1296
Column: 12
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
store = as_sdl(temp, ScratchRegister, 7);
as_sdr(temp, ScratchRegister, 0);
}
append(access, store.getOffset(), asMasm().framePushed());
}
void
MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
{
Reported by FlawFinder.
Line: 2351
Column: 59
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, Register64 output)
{
wasmLoadI64Impl(access, memoryBase, ptr, ptrScratch, output, InvalidReg);
}
Reported by FlawFinder.
Line: 2354
Column: 21
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, Register64 output)
{
wasmLoadI64Impl(access, memoryBase, ptr, ptrScratch, output, InvalidReg);
}
void
MacroAssembler::wasmUnalignedLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase,
Register ptr, Register ptrScratch, Register64 output,
Reported by FlawFinder.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/matchers/_datastructures.py
34 issues
Line: 12
Column: 1
"""Matchers that operate with knowledge of Python data structures."""
from ..helpers import map_values
from ._higherorder import (
Annotate,
MatchesAll,
MismatchesAll,
)
Reported by Pylint.
Line: 13
Column: 1
"""Matchers that operate with knowledge of Python data structures."""
from ..helpers import map_values
from ._higherorder import (
Annotate,
MatchesAll,
MismatchesAll,
)
from ._impl import Mismatch
Reported by Pylint.
Line: 18
Column: 1
MatchesAll,
MismatchesAll,
)
from ._impl import Mismatch
def ContainsAll(items):
"""Make a matcher that checks whether a list of things is contained
in another thing.
Reported by Pylint.
Line: 28
Column: 5
The matcher effectively checks that the provided sequence is a subset of
the matchee.
"""
from ._basic import Contains
return MatchesAll(*map(Contains, items), first_only=False)
class MatchesListwise(object):
"""Matches if each matcher matches the corresponding value.
Reported by Pylint.
Line: 61
Column: 9
self.first_only = first_only
def match(self, values):
from ._basic import Equals
mismatches = []
length_mismatch = Annotate(
"Length mismatch", Equals(len(self.matchers))).match(len(values))
if length_mismatch:
mismatches.append(length_mismatch)
Reported by Pylint.
Line: 108
Column: 9
Similar to the constructor, except that the matcher is assumed to be
Equals.
"""
from ._basic import Equals
return cls.byMatcher(Equals, **kwargs)
@classmethod
def byMatcher(cls, matcher, **kwargs):
"""Matches an object where the attributes match the keyword values.
Reported by Pylint.
Line: 122
Column: 9
@classmethod
def fromExample(cls, example, *attributes):
from ._basic import Equals
kwargs = {}
for attr in attributes:
kwargs[attr] = Equals(getattr(example, attr))
return cls(**kwargs)
Reported by Pylint.
Line: 1
Column: 1
# Copyright (c) 2009-2012 testtools developers. See LICENSE for details.
__all__ = [
'ContainsAll',
'MatchesListwise',
'MatchesSetwise',
'MatchesStructure',
]
Reported by Pylint.
Line: 12
Column: 1
"""Matchers that operate with knowledge of Python data structures."""
from ..helpers import map_values
from ._higherorder import (
Annotate,
MatchesAll,
MismatchesAll,
)
Reported by Pylint.
Line: 13
Column: 1
"""Matchers that operate with knowledge of Python data structures."""
from ..helpers import map_values
from ._higherorder import (
Annotate,
MatchesAll,
MismatchesAll,
)
from ._impl import Mismatch
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_bug001.py
34 issues
Line: 32
Column: 1
# test_bug001.py
# Regression tests.
import wiredtiger, wttest
# Regression tests.
class test_bug001(wttest.WiredTigerTestCase):
def create_implicit(self, uri, initial, middle, trailing):
Reported by Pylint.
Line: 32
Column: 1
# test_bug001.py
# Regression tests.
import wiredtiger, wttest
# Regression tests.
class test_bug001(wttest.WiredTigerTestCase):
def create_implicit(self, uri, initial, middle, trailing):
Reported by Pylint.
Line: 44
Column: 13
# Create a set of initial implicit records, followed by a set of real
# records, followed by a set of trailing implicit records.
r = initial
for i in range(0, middle):
r += 1
cursor[r] = 0xab
r += trailing
cursor[r + 1] = 0xbb
return (cursor)
Reported by Pylint.
Line: 62
Column: 9
# Check cursor next inside trailing implicit keys.
cursor.set_key(60)
self.assertEquals(cursor.search(), 0)
for i in range(0, 5):
self.assertEqual(cursor.get_key(), 60 + i)
self.assertEqual(cursor.get_value(), 0x00)
self.assertEqual(cursor.next(), 0)
Reported by Pylint.
Line: 70
Column: 9
# Check cursor prev inside trailing implicit keys.
cursor.set_key(60)
self.assertEquals(cursor.search(), 0)
for i in range(0, 5):
self.assertEqual(cursor.get_key(), 60 - i)
self.assertEqual(cursor.get_value(), 0x00)
self.assertEqual(cursor.prev(), 0)
Reported by Pylint.
Line: 76
Column: 9
self.assertEqual(cursor.get_value(), 0x00)
self.assertEqual(cursor.prev(), 0)
self.assertEquals(cursor.close(), 0)
self.session.drop(uri)
cursor = self.create_implicit(uri, 20, 50, 0)
# Check search inside leading implicit keys.
for i in range(0, 5):
Reported by Pylint.
Line: 86
Column: 9
# Check cursor next inside leading implicit keys.
cursor.set_key(10)
self.assertEquals(cursor.search(), 0)
for i in range(0, 5):
self.assertEqual(cursor.get_key(), 10 + i)
self.assertEqual(cursor.get_value(), 0x00)
self.assertEqual(cursor.next(), 0)
Reported by Pylint.
Line: 94
Column: 9
# Check cursor prev inside leading implicit keys.
cursor.set_key(10)
self.assertEquals(cursor.search(), 0)
for i in range(0, 5):
self.assertEqual(cursor.get_key(), 10 - i)
self.assertEqual(cursor.get_value(), 0x00)
self.assertEqual(cursor.prev(), 0)
Reported by Pylint.
Line: 100
Column: 9
self.assertEqual(cursor.get_value(), 0x00)
self.assertEqual(cursor.prev(), 0)
self.assertEquals(cursor.close(), 0)
self.session.drop(uri)
# Test a bug where cursor remove inside implicit records looped infinitely.
def test_implicit_record_cursor_remove(self):
uri='file:xxx'
Reported by Pylint.
Line: 110
Column: 9
# Check cursor next/remove inside trailing implicit keys.
cursor.set_key(62)
self.assertEquals(cursor.search(), 0)
for i in range(1, 5):
self.assertEquals(cursor.next(), 0)
self.assertEqual(cursor.get_key(), 62 + i)
self.assertEqual(cursor.get_value(), 0x00)
self.assertEquals(cursor.remove(), 0)
Reported by Pylint.