The following issues were found
src/third_party/wiredtiger/test/suite/test_txn14.py
12 issues
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 83
Column: 9
self.assertEqual(i, key)
self.assertEqual(i+1, value)
i += 1
all = self.entries + self.extra_entries
self.assertEqual(i, all + 1)
c.close()
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: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 39
Column: 1
from wtscenario import make_scenarios
import wttest
class test_txn14(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn14_1'
entries = 10000
extra_entries = 5
conn_config = 'log=(archive=false,enabled,file_max=100K)'
Reported by Pylint.
Line: 39
Column: 1
from wtscenario import make_scenarios
import wttest
class test_txn14(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn14_1'
entries = 10000
extra_entries = 5
conn_config = 'log=(archive=false,enabled,file_max=100K)'
Reported by Pylint.
Line: 55
Column: 5
]
scenarios = make_scenarios(sync_list, key_format_values)
def test_log_flush(self):
# Here's the strategy:
# - Create a table.
# - Insert data into table.
# - Call log_flush.
# - Simulate a crash and restart
Reported by Pylint.
src/third_party/wiredtiger/src/utilities/util_dump.c
12 issues
Line: 289
CWE codes:
908
ret = util_err(session, ret, "%s", uri);
if ((tret = mcursor->close(mcursor)) != 0) {
tret = util_cerr(mcursor, "close", tret);
if (ret == 0)
ret = tret;
}
return (ret);
Reported by Cppcheck.
Line: 351
Column: 33
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
static int
dump_add_config(WT_SESSION *session, char **bufp, size_t *leftp, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format(printf, 4, 5)))
{
WT_DECL_RET;
size_t n;
va_list ap;
Reported by FlawFinder.
Line: 129
Column: 20
CWE codes:
362
/* Open any optional output file. */
if (ofile == NULL)
fp = stdout;
else if ((fp = fopen(ofile, "w")) == NULL)
return (util_err(session, errno, "%s: open", ofile));
if (json && (dump_json_begin(session) != 0 || dump_prefix(session, pretty, hex, json) != 0))
goto err;
Reported by FlawFinder.
Line: 383
Column: 59
CWE codes:
126
char *newconfig;
const char *keyformat, *p;
len = strlen(config) + strlen(cursor->value_format) + strlen(cursor->uri) + 20;
if ((newconfig = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
Reported by FlawFinder.
Line: 383
Column: 11
CWE codes:
126
char *newconfig;
const char *keyformat, *p;
len = strlen(config) + strlen(cursor->value_format) + strlen(cursor->uri) + 20;
if ((newconfig = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
Reported by FlawFinder.
Line: 383
Column: 28
CWE codes:
126
char *newconfig;
const char *keyformat, *p;
len = strlen(config) + strlen(cursor->value_format) + strlen(cursor->uri) + 20;
if ((newconfig = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
Reported by FlawFinder.
Line: 388
Column: 68
CWE codes:
126
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
return (util_err(session, ret, "WT_EXTENSION_API.config_parser_open"));
keyformat = cursor->key_format;
for (nkeys = 0; *keyformat; keyformat++)
if (!__wt_isdigit((u_char)*keyformat))
nkeys++;
Reported by FlawFinder.
Line: 418
Column: 22
CWE codes:
126
/* copy names of projected values */
p = strchr(cursor->uri, '(');
assert(p != NULL);
assert(p[strlen(p) - 1] == ')');
p++;
if (*p != ')')
WT_RET(dump_add_config(session, &newconfig, &len, "%s", ","));
WT_RET(dump_add_config(session, &newconfig, &len, "%.*s),", (int)(strlen(p) - 1), p));
} else if (value.type == WT_CONFIG_ITEM_STRING && value.len != 0)
Reported by FlawFinder.
Line: 422
Column: 79
CWE codes:
126
p++;
if (*p != ')')
WT_RET(dump_add_config(session, &newconfig, &len, "%s", ","));
WT_RET(dump_add_config(session, &newconfig, &len, "%.*s),", (int)(strlen(p) - 1), p));
} else if (value.type == WT_CONFIG_ITEM_STRING && value.len != 0)
WT_RET(
dump_add_config(session, &newconfig, &len, "\"%.*s\",", (int)value.len, value.str));
else
WT_RET(dump_add_config(session, &newconfig, &len, "%.*s,", (int)value.len, value.str));
Reported by FlawFinder.
Line: 514
Column: 27
CWE codes:
126
return (util_err(session, EIO, NULL));
}
len = strlen(entry) + strlen(name) + 1;
if ((uriprefix = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
if ((ret = __wt_snprintf(uriprefix, len, "%s%s", entry, name)) != 0) {
free(uriprefix);
return (util_err(session, ret, NULL));
Reported by FlawFinder.
src/third_party/asio-master/asio/include/asio/read.hpp
12 issues
Line: 77
Column: 13
CWE codes:
120
20
* asio::transfer_all()); @endcode
*/
template <typename SyncReadStream, typename MutableBufferSequence>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
typename enable_if<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
/// Attempt to read a certain amount of data from a stream before returning.
Reported by FlawFinder.
Line: 119
Column: 13
CWE codes:
120
20
* asio::transfer_all(), ec); @endcode
*/
template <typename SyncReadStream, typename MutableBufferSequence>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
asio::error_code& ec,
typename enable_if<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
Reported by FlawFinder.
Line: 173
Column: 13
CWE codes:
120
20
*/
template <typename SyncReadStream, typename MutableBufferSequence,
typename CompletionCondition>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition,
typename enable_if<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
Reported by FlawFinder.
Line: 220
Column: 13
CWE codes:
120
20
*/
template <typename SyncReadStream, typename MutableBufferSequence,
typename CompletionCondition>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, asio::error_code& ec,
typename enable_if<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
Reported by FlawFinder.
Line: 254
Column: 13
CWE codes:
120
20
* asio::transfer_all()); @endcode
*/
template <typename SyncReadStream, typename DynamicBuffer>
std::size_t read(SyncReadStream& s,
ASIO_MOVE_ARG(DynamicBuffer) buffers,
typename enable_if<
is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value
>::type* = 0);
Reported by FlawFinder.
Line: 287
Column: 13
CWE codes:
120
20
* asio::transfer_all(), ec); @endcode
*/
template <typename SyncReadStream, typename DynamicBuffer>
std::size_t read(SyncReadStream& s,
ASIO_MOVE_ARG(DynamicBuffer) buffers,
asio::error_code& ec,
typename enable_if<
is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value
>::type* = 0);
Reported by FlawFinder.
Line: 332
Column: 13
CWE codes:
120
20
*/
template <typename SyncReadStream, typename DynamicBuffer,
typename CompletionCondition>
std::size_t read(SyncReadStream& s,
ASIO_MOVE_ARG(DynamicBuffer) buffers,
CompletionCondition completion_condition,
typename enable_if<
is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value
>::type* = 0);
Reported by FlawFinder.
Line: 378
Column: 13
CWE codes:
120
20
*/
template <typename SyncReadStream, typename DynamicBuffer,
typename CompletionCondition>
std::size_t read(SyncReadStream& s,
ASIO_MOVE_ARG(DynamicBuffer) buffers,
CompletionCondition completion_condition, asio::error_code& ec,
typename enable_if<
is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value
>::type* = 0);
Reported by FlawFinder.
Line: 415
Column: 13
CWE codes:
120
20
* asio::transfer_all()); @endcode
*/
template <typename SyncReadStream, typename Allocator>
std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b);
/// Attempt to read a certain amount of data from a stream before returning.
/**
* This function is used to read a certain number of bytes of data from a
* stream. The call will block until one of the following conditions is true:
Reported by FlawFinder.
Line: 444
Column: 13
CWE codes:
120
20
* asio::transfer_all(), ec); @endcode
*/
template <typename SyncReadStream, typename Allocator>
std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b,
asio::error_code& ec);
/// Attempt to read a certain amount of data from a stream before returning.
/**
* This function is used to read a certain number of bytes of data from a
Reported by FlawFinder.
src/third_party/abseil-cpp-master/abseil-cpp/absl/types/compare_test.cc
12 issues
Line: 242
}
struct WeakOrderingLess {
template <typename T>
absl::weak_ordering operator()(const T& a, const T& b) const {
return a < b ? absl::weak_ordering::less
: a == b ? absl::weak_ordering::equivalent
: absl::weak_ordering::greater;
}
Reported by Cppcheck.
Line: 47
Column: 46
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
TEST(Compare, StrongEquality) {
EXPECT_TRUE(Identity(strong_equality::equal == 0));
EXPECT_TRUE(Identity(0 == strong_equality::equal));
EXPECT_TRUE(Identity(strong_equality::nonequal != 0));
EXPECT_TRUE(Identity(0 != strong_equality::nonequal));
EXPECT_TRUE(Identity(strong_equality::equivalent == 0));
EXPECT_TRUE(Identity(0 == strong_equality::equivalent));
EXPECT_TRUE(Identity(strong_equality::nonequivalent != 0));
Reported by FlawFinder.
Line: 54
Column: 54
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_TRUE(Identity(0 == strong_equality::equivalent));
EXPECT_TRUE(Identity(strong_equality::nonequivalent != 0));
EXPECT_TRUE(Identity(0 != strong_equality::nonequivalent));
const strong_equality values[] = {strong_equality::equal,
strong_equality::nonequal};
for (const auto& lhs : values) {
for (const auto& rhs : values) {
const bool are_equal = &lhs == &rhs;
EXPECT_EQ(lhs == rhs, are_equal);
Reported by FlawFinder.
Line: 63
Column: 72
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_EQ(lhs != rhs, !are_equal);
}
}
EXPECT_TRUE(Identity(strong_equality::equivalent == strong_equality::equal));
EXPECT_TRUE(
Identity(strong_equality::nonequivalent == strong_equality::nonequal));
}
TEST(Compare, PartialOrdering) {
Reported by FlawFinder.
Line: 129
Column: 46
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_TRUE(Identity(strong_ordering::less <= 0));
EXPECT_TRUE(Identity(0 >= strong_ordering::less));
EXPECT_TRUE(Identity(strong_ordering::equal == 0));
EXPECT_TRUE(Identity(0 == strong_ordering::equal));
EXPECT_TRUE(Identity(strong_ordering::equivalent == 0));
EXPECT_TRUE(Identity(0 == strong_ordering::equivalent));
EXPECT_TRUE(Identity(strong_ordering::greater > 0));
EXPECT_TRUE(Identity(0 < strong_ordering::greater));
EXPECT_TRUE(Identity(strong_ordering::greater >= 0));
Reported by FlawFinder.
Line: 137
Column: 47
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_TRUE(Identity(strong_ordering::greater >= 0));
EXPECT_TRUE(Identity(0 <= strong_ordering::greater));
const strong_ordering values[] = {
strong_ordering::less, strong_ordering::equal, strong_ordering::greater};
for (const auto& lhs : values) {
for (const auto& rhs : values) {
const bool are_equal = &lhs == &rhs;
EXPECT_EQ(lhs == rhs, are_equal);
EXPECT_EQ(lhs != rhs, !are_equal);
Reported by FlawFinder.
Line: 145
Column: 72
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_EQ(lhs != rhs, !are_equal);
}
}
EXPECT_TRUE(Identity(strong_ordering::equivalent == strong_ordering::equal));
}
TEST(Compare, Conversions) {
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_equality::equal) == 0));
Reported by FlawFinder.
Line: 150
Column: 62
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
TEST(Compare, Conversions) {
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_equality::equal) == 0));
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_equality::nonequal) != 0));
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_equality::equivalent) == 0));
EXPECT_TRUE(Identity(
Reported by FlawFinder.
Line: 191
Column: 62
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_ordering::less) != 0));
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_ordering::equal) == 0));
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_ordering::equivalent) == 0));
EXPECT_TRUE(
Identity(implicit_cast<weak_equality>(strong_ordering::greater) != 0));
Reported by FlawFinder.
Line: 200
Column: 64
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
EXPECT_TRUE(
Identity(implicit_cast<strong_equality>(strong_ordering::less) != 0));
EXPECT_TRUE(
Identity(implicit_cast<strong_equality>(strong_ordering::equal) == 0));
EXPECT_TRUE(Identity(
implicit_cast<strong_equality>(strong_ordering::equivalent) == 0));
EXPECT_TRUE(
Identity(implicit_cast<strong_equality>(strong_ordering::greater) != 0));
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_drop.py
12 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os, time
import wiredtiger, wttest
from helper import confirm_does_not_exist
from wtdataset import SimpleDataSet, ComplexDataSet
from wtscenario import make_scenarios
# test_drop.py
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 os, time
import wiredtiger, wttest
from helper import confirm_does_not_exist
from wtdataset import SimpleDataSet, ComplexDataSet
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 os, time
import wiredtiger, wttest
from helper import confirm_does_not_exist
from wtdataset import SimpleDataSet, ComplexDataSet
from wtscenario import make_scenarios
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 os, time
import wiredtiger, wttest
from helper import confirm_does_not_exist
from wtdataset import SimpleDataSet, ComplexDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os, time
import wiredtiger, wttest
from helper import confirm_does_not_exist
from wtdataset import SimpleDataSet, ComplexDataSet
from wtscenario import make_scenarios
# test_drop.py
Reported by Pylint.
Line: 37
Column: 1
# test_drop.py
# session level drop operation
class test_drop(wttest.WiredTigerTestCase):
name = 'test_drop'
extra_config = ''
scenarios = make_scenarios([
('file', dict(uri='file:')),
Reported by Pylint.
Line: 37
Column: 1
# test_drop.py
# session level drop operation
class test_drop(wttest.WiredTigerTestCase):
name = 'test_drop'
extra_config = ''
scenarios = make_scenarios([
('file', dict(uri='file:')),
Reported by Pylint.
Line: 48
Column: 5
])
# Populate an object, remove it and confirm it no longer exists.
def drop(self, dataset, with_cursor, reopen, drop_index):
uri = self.uri + self.name
ds = dataset(self, uri, 10, config=self.extra_config)
ds.populate()
# Open cursors should cause failure.
Reported by Pylint.
Line: 50
Column: 9
# Populate an object, remove it and confirm it no longer exists.
def drop(self, dataset, with_cursor, reopen, drop_index):
uri = self.uri + self.name
ds = dataset(self, uri, 10, config=self.extra_config)
ds.populate()
# Open cursors should cause failure.
if with_cursor:
cursor = self.session.open_cursor(uri, None, None)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_txn06.py
12 issues
Line: 34
Column: 1
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
conn_config = 'verbose=[transaction]'
tablename = 'test_txn06'
Reported by Pylint.
Line: 34
Column: 1
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
conn_config = 'verbose=[transaction]'
tablename = 'test_txn06'
Reported by Pylint.
Line: 59
Column: 9
# Now scan the table and copy the rows into a new table. The cursor will keep the snapshot
# in self.session pinned while the inserts cause new IDs to be allocated.
format = "key_format={},value_format={}".format(self.key_format, self.value_format)
c_src = self.session.create(self.uri, format)
c_src = self.session.open_cursor(self.source_uri)
insert_session = self.conn.open_session()
c = insert_session.open_cursor(self.uri)
for k, v in c_src:
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 suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
conn_config = 'verbose=[transaction]'
tablename = 'test_txn06'
Reported by Pylint.
Line: 34
Column: 1
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
conn_config = 'verbose=[transaction]'
tablename = 'test_txn06'
Reported by Pylint.
Line: 37
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
conn_config = 'verbose=[transaction]'
tablename = 'test_txn06'
uri = 'table:' + tablename
source_uri = 'table:' + tablename + "_src"
nrows = 100000
Reported by Pylint.
Line: 37
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
conn_config = 'verbose=[transaction]'
tablename = 'test_txn06'
uri = 'table:' + tablename
source_uri = 'table:' + tablename + "_src"
nrows = 100000
Reported by Pylint.
Line: 51
Column: 5
]
scenarios = make_scenarios(format_values)
def test_long_running(self):
# Populate a table
ds = SimpleDataSet(self, self.source_uri, self.nrows,
key_format=self.key_format, value_format=self.value_format)
ds.populate()
Reported by Pylint.
Line: 53
Column: 9
def test_long_running(self):
# Populate a table
ds = SimpleDataSet(self, self.source_uri, self.nrows,
key_format=self.key_format, value_format=self.value_format)
ds.populate()
# Now scan the table and copy the rows into a new table. The cursor will keep the snapshot
# in self.session pinned while the inserts cause new IDs to be allocated.
Reported by Pylint.
src/third_party/icu4c-57.1/source/common/icuplug.cpp
12 issues
Line: 42
Column: 62
CWE codes:
134
Suggestion:
Use a constant for the format specification
#if UPLUG_TRACE
#include <stdio.h>
#define DBG(x) fprintf(stderr, "%s:%d: ",__FILE__,__LINE__); fprintf x
#endif
/**
* Internal structure of an ICU plugin.
*/
Reported by FlawFinder.
Line: 726
Column: 21
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
(void)status; /* unused */
#elif !UCONFIG_NO_FILE_IO
CharString plugin_dir;
const char *env = getenv("ICU_PLUGINS");
if(U_FAILURE(*status)) return;
if(env != NULL) {
plugin_dir.append(env, -1, *status);
}
Reported by FlawFinder.
Line: 54
Column: 3
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 structSize; /**< initialized to the size of this structure */
uint32_t token; /**< must be U_PLUG_TOKEN */
void *lib; /**< plugin library, or NULL */
char libName[UPLUG_NAME_MAX]; /**< library name */
char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
char config[UPLUG_NAME_MAX]; /**< configuration data */
void *context; /**< user context data */
char name[UPLUG_NAME_MAX]; /**< name of plugin */
UPlugLevel level; /**< level of plugin */
Reported by FlawFinder.
Line: 55
Column: 3
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 token; /**< must be U_PLUG_TOKEN */
void *lib; /**< plugin library, or NULL */
char libName[UPLUG_NAME_MAX]; /**< library name */
char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
char config[UPLUG_NAME_MAX]; /**< configuration data */
void *context; /**< user context data */
char name[UPLUG_NAME_MAX]; /**< name of plugin */
UPlugLevel level; /**< level of plugin */
UBool awaitingLoad; /**< TRUE if the plugin is awaiting a load call */
Reported by FlawFinder.
Line: 56
Column: 3
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
void *lib; /**< plugin library, or NULL */
char libName[UPLUG_NAME_MAX]; /**< library name */
char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
char config[UPLUG_NAME_MAX]; /**< configuration data */
void *context; /**< user context data */
char name[UPLUG_NAME_MAX]; /**< name of plugin */
UPlugLevel level; /**< level of plugin */
UBool awaitingLoad; /**< TRUE if the plugin is awaiting a load call */
UBool dontUnload; /**< TRUE if plugin must stay resident (leak plugin and lib) */
Reported by FlawFinder.
Line: 58
Column: 3
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 sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
char config[UPLUG_NAME_MAX]; /**< configuration data */
void *context; /**< user context data */
char name[UPLUG_NAME_MAX]; /**< name of plugin */
UPlugLevel level; /**< level of plugin */
UBool awaitingLoad; /**< TRUE if the plugin is awaiting a load call */
UBool dontUnload; /**< TRUE if plugin must stay resident (leak plugin and lib) */
UErrorCode pluginStatus; /**< status code of plugin */
};
Reported by FlawFinder.
Line: 110
Column: 3
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
*/
typedef struct UPlugLibrary {
void *lib; /**< library ptr */
char name[UPLUG_NAME_MAX]; /**< library name */
uint32_t ref; /**< reference count */
} UPlugLibrary;
static UPlugLibrary staticLibraryList[UPLUG_LIBRARY_INITIAL_COUNT];
static UPlugLibrary * libraryList = staticLibraryList;
Reported by FlawFinder.
Line: 705
Column: 8
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
}
/* Name of the plugin config file */
static char plugin_file[2048] = "";
#endif
U_INTERNAL const char* U_EXPORT2
uplug_getPluginFile() {
#if U_ENABLE_DYLOAD && !UCONFIG_NO_FILE_IO
Reported by FlawFinder.
Line: 797
Column: 13
CWE codes:
362
else
#endif
{
f = fopen(pluginFile.data(), "r");
}
if(f != NULL) {
char linebuf[1024];
char *p, *libName=NULL, *symName=NULL, *config=NULL;
Reported by FlawFinder.
Line: 801
Column: 7
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
}
if(f != NULL) {
char linebuf[1024];
char *p, *libName=NULL, *symName=NULL, *config=NULL;
int32_t line = 0;
while(fgets(linebuf,1023,f)) {
Reported by FlawFinder.
src/third_party/wiredtiger/src/support/timestamp.c
12 issues
Line: 31
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
__wt_time_point_to_string(
wt_timestamp_t ts, wt_timestamp_t durable_ts, uint64_t txn_id, char *tp_string)
{
char ts_string[WT_TS_INT_STRING_SIZE];
WT_IGNORE_RET(__wt_snprintf(tp_string, WT_TP_STRING_SIZE, "%s/%s/%" PRIu64,
__wt_timestamp_to_string(ts, ts_string), __wt_timestamp_to_string(durable_ts, ts_string),
txn_id));
return (tp_string);
Reported by FlawFinder.
Line: 46
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
char *
__wt_time_window_to_string(WT_TIME_WINDOW *tw, char *tw_string)
{
char ts_string[4][WT_TS_INT_STRING_SIZE];
WT_IGNORE_RET(__wt_snprintf(tw_string, WT_TIME_STRING_SIZE,
"start: %s/%s/%" PRIu64 " stop: %s/%s/%" PRIu64 "%s",
__wt_timestamp_to_string(tw->durable_start_ts, ts_string[0]),
__wt_timestamp_to_string(tw->start_ts, ts_string[1]), tw->start_txn,
Reported by FlawFinder.
Line: 65
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
char *
__wt_time_aggregate_to_string(WT_TIME_AGGREGATE *ta, char *ta_string)
{
char ts_string[4][WT_TS_INT_STRING_SIZE];
WT_IGNORE_RET(__wt_snprintf(ta_string, WT_TIME_STRING_SIZE,
"newest durable: %s/%s oldest start: %s/%" PRIu64 " newest stop %s/%" PRIu64 "%s",
__wt_timestamp_to_string(ta->newest_start_durable_ts, ts_string[0]),
__wt_timestamp_to_string(ta->newest_stop_durable_ts, ts_string[1]),
Reported by FlawFinder.
Line: 93
Column: 15
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
if (ts == WT_TS_MAX) {
#define WT_TS_MAX_HEX_STRING "ffffffffffffffff"
(void)memcpy(hex_timestamp, WT_TS_MAX_HEX_STRING, strlen(WT_TS_MAX_HEX_STRING) + 1);
return;
}
for (p = hex_timestamp; ts != 0; ts >>= 4)
*p++ = (char)__wt_hex((u_char)(ts & 0x0f));
Reported by FlawFinder.
Line: 116
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
void
__wt_verbose_timestamp(WT_SESSION_IMPL *session, wt_timestamp_t ts, const char *msg)
{
char ts_string[WT_TS_INT_STRING_SIZE];
__wt_verbose(
session, WT_VERB_TIMESTAMP, "Timestamp %s: %s", __wt_timestamp_to_string(ts, ts_string), msg);
}
Reported by FlawFinder.
Line: 161
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
WT_SESSION_IMPL *session, WT_TIME_AGGREGATE *ta, bool silent)
{
wt_timestamp_t stable;
char time_string[WT_TIME_STRING_SIZE], ts_string[WT_TS_INT_STRING_SIZE];
stable = __time_stable(session);
if (ta->newest_start_durable_ts > stable)
WT_TIME_ERROR("a newest start durable time after");
Reported by FlawFinder.
Line: 185
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
__time_aggregate_validate_parent(
WT_SESSION_IMPL *session, WT_TIME_AGGREGATE *ta, WT_TIME_AGGREGATE *parent, bool silent)
{
char time_string[2][WT_TIME_STRING_SIZE];
if (ta->newest_start_durable_ts > parent->newest_start_durable_ts)
WT_TIME_VALIDATE_RET(session,
"aggregate time window has a newest start durable time after its parent's; time "
"aggregate %s, parent %s",
Reported by FlawFinder.
Line: 246
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
__wt_time_aggregate_validate(
WT_SESSION_IMPL *session, WT_TIME_AGGREGATE *ta, WT_TIME_AGGREGATE *parent, bool silent)
{
char time_string[2][WT_TIME_STRING_SIZE];
if (ta->oldest_start_ts > ta->newest_stop_ts)
WT_TIME_VALIDATE_RET(session,
"aggregate time window has an oldest start time after its newest stop time; time "
"aggregate %s",
Reported by FlawFinder.
Line: 322
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
__time_value_validate_parent_stable(WT_SESSION_IMPL *session, WT_TIME_WINDOW *tw, bool silent)
{
wt_timestamp_t stable;
char time_string[WT_TIME_STRING_SIZE], ts_string[WT_TS_INT_STRING_SIZE];
stable = __time_stable(session);
if (tw->durable_start_ts > stable)
WT_TIME_ERROR("a durable start time after");
Reported by FlawFinder.
Line: 346
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
__time_value_validate_parent(
WT_SESSION_IMPL *session, WT_TIME_WINDOW *tw, WT_TIME_AGGREGATE *parent, bool silent)
{
char time_string[2][WT_TIME_STRING_SIZE];
if (parent->newest_start_durable_ts != WT_TS_NONE &&
tw->durable_start_ts > parent->newest_start_durable_ts)
WT_TIME_VALIDATE_RET(session,
"value time window has a durable start time after its parent's newest durable start "
Reported by FlawFinder.
src/third_party/gperftools/dist/src/tests/tcmalloc_unittest.cc
12 issues
Line: 635
CWE codes:
628
}
static void TestCalloc(size_t n, size_t s, bool ok) {
char* p = reinterpret_cast<char*>(calloc(n, s));
if (FLAGS_verbose)
fprintf(LOGSTREAM, "calloc(%zx, %zx): %p\n", n, s, p);
if (!ok) {
CHECK(p == NULL); // calloc(n, s) should not succeed
} else {
Reported by Cppcheck.
Line: 266
Column: 5
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
public:
TestHarness(int seed)
: types_(new vector<Type>), total_weight_(0), num_tests_(0) {
srandom(seed);
}
~TestHarness() {
delete types_;
}
Reported by FlawFinder.
Line: 289
Column: 14
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
// If n != 0, returns the next pseudo-random number in the range [0 .. n)
int Uniform(int n) {
if (n == 0) {
return random() * 0;
} else {
return random() % n;
}
}
// Pick "base" uniformly from range [0,max_log] and then return
Reported by FlawFinder.
Line: 291
Column: 14
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
if (n == 0) {
return random() * 0;
} else {
return random() % n;
}
}
// Pick "base" uniformly from range [0,max_log] and then return
// "base" random bits. The effect is to pick a number in the range
// [0,2^max_log-1] with bias towards smaller numbers.
Reported by FlawFinder.
Line: 298
Column: 22
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
// "base" random bits. The effect is to pick a number in the range
// [0,2^max_log-1] with bias towards smaller numbers.
int Skewed(int max_log) {
const int base = random() % (max_log+1);
return random() % (1 << base);
}
private:
vector<Type>* types_; // Registered types
Reported by FlawFinder.
Line: 299
Column: 12
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
// [0,2^max_log-1] with bias towards smaller numbers.
int Skewed(int max_log) {
const int base = random() % (max_log+1);
return random() % (1 << base);
}
private:
vector<Type>* types_; // Registered types
int total_weight_; // Total weight of all types
Reported by FlawFinder.
Line: 160
Column: 12
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
#else
alignas(OVERALIGNMENT)
#endif
unsigned char data[OVERALIGNMENT * 2]; // make the object size different from
// alignment to make sure the correct
// values are passed to the new/delete
// implementation functions
};
Reported by FlawFinder.
Line: 196
Column: 3
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
};
static union {
char buf[sizeof(OOMAbleSysAlloc)];
void *ptr;
} test_sys_alloc_space;
static OOMAbleSysAlloc* get_test_sys_alloc() {
return reinterpret_cast<OOMAbleSysAlloc*>(&test_sys_alloc_space);
Reported by FlawFinder.
Line: 1202
Column: 33
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
static int RunAllTests(int argc, char** argv) {
// Optional argv[1] is the seed
AllocatorState rnd(argc > 1 ? atoi(argv[1]) : 100);
SetTestResourceLimit();
#ifndef DEBUGALLOCATION
TestNewOOMHandling();
Reported by FlawFinder.
Line: 1506
Column: 14
CWE codes:
362
munmap(p1, size);
VerifyMunmapHookWasCalled();
int fd = open("/dev/zero", O_RDONLY);
CHECK_GE(fd, 0); // make sure the open succeeded
p1 = mmap(NULL, 8192, PROT_READ, MAP_SHARED, fd, 0);
CHECK(p1 != NULL);
VerifyMmapHookWasCalled();
munmap(p1, 8192);
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_stat06.py
12 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 helper, wiredtiger, wttest
from time import sleep
from wiredtiger import stat
# test_stat06.py
# Check that statistics are started or stopped when intended
Reported by Pylint.
Line: 31
Column: 1
import helper, wiredtiger, wttest
from time import sleep
from wiredtiger import stat
# test_stat06.py
# Check that statistics are started or stopped when intended
class test_stat06(wttest.WiredTigerTestCase):
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 helper, wiredtiger, wttest
from time import sleep
from wiredtiger import stat
# test_stat06.py
# Check that statistics are started or stopped when intended
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 helper, wiredtiger, wttest
from time import sleep
from wiredtiger import stat
# test_stat06.py
# Check that statistics are started or stopped when intended
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import helper, wiredtiger, wttest
from time import sleep
from wiredtiger import stat
# test_stat06.py
# Check that statistics are started or stopped when intended
class test_stat06(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 31
Column: 1
import helper, wiredtiger, wttest
from time import sleep
from wiredtiger import stat
# test_stat06.py
# Check that statistics are started or stopped when intended
class test_stat06(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 35
Column: 1
# test_stat06.py
# Check that statistics are started or stopped when intended
class test_stat06(wttest.WiredTigerTestCase):
def test_stats_on(self):
self.close_conn()
self.conn = self.wiredtiger_open(None, "statistics=(fast)")
self.stats_gathered(True)
Reported by Pylint.
Line: 35
Column: 1
# test_stat06.py
# Check that statistics are started or stopped when intended
class test_stat06(wttest.WiredTigerTestCase):
def test_stats_on(self):
self.close_conn()
self.conn = self.wiredtiger_open(None, "statistics=(fast)")
self.stats_gathered(True)
Reported by Pylint.
Line: 37
Column: 5
# Check that statistics are started or stopped when intended
class test_stat06(wttest.WiredTigerTestCase):
def test_stats_on(self):
self.close_conn()
self.conn = self.wiredtiger_open(None, "statistics=(fast)")
self.stats_gathered(True)
def test_stats_off(self):
Reported by Pylint.