The following issues were found
src/third_party/wiredtiger/test/suite/test_gc02.py
12 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from test_gc01 import test_gc_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_gc02.py
# Test that checkpoint cleans the obsolete history store internal pages.
class test_gc02(test_gc_base):
Reported by Pylint.
Line: 125
Column: 5
self.check(bigvalue, uri, nrows, 200)
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: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from test_gc01 import test_gc_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_gc02.py
# Test that checkpoint cleans the obsolete history store internal pages.
class test_gc02(test_gc_base):
Reported by Pylint.
Line: 35
Column: 1
# test_gc02.py
# Test that checkpoint cleans the obsolete history store internal pages.
class test_gc02(test_gc_base):
conn_config = 'cache_size=1GB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
def test_gc(self):
nrows = 100000
Reported by Pylint.
Line: 35
Column: 1
# test_gc02.py
# Test that checkpoint cleans the obsolete history store internal pages.
class test_gc02(test_gc_base):
conn_config = 'cache_size=1GB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
def test_gc(self):
nrows = 100000
Reported by Pylint.
Line: 39
Column: 5
conn_config = 'cache_size=1GB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
def test_gc(self):
nrows = 100000
# Create a table without logging.
uri = "table:gc02"
ds = SimpleDataSet(
Reported by Pylint.
Line: 44
Column: 9
# Create a table without logging.
uri = "table:gc02"
ds = SimpleDataSet(
self, uri, 0, key_format="i", value_format="S", config='log=(enabled=false)')
ds.populate()
# Pin oldest and stable to timestamp 1.
self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(1) +
Reported by Pylint.
Line: 69
Column: 9
# Checkpoint to ensure that the history store is checkpointed and not cleaned.
self.session.checkpoint()
c = self.session.open_cursor('statistics:')
self.assertEqual(c[stat.conn.cc_pages_evict][2], 0)
self.assertEqual(c[stat.conn.cc_pages_removed][2], 0)
self.assertGreater(c[stat.conn.cc_pages_visited][2], 0)
c.close()
Reported by Pylint.
Line: 97
Column: 9
self.large_updates(uri, bigvalue, ds, nrows, 200)
# Check that the modifies are seen.
bigvalue_modA = bigvalue2[0:10] + 'A' + bigvalue2[11:]
bigvalue_modB = bigvalue_modA[0:20] + 'B' + bigvalue_modA[21:]
bigvalue_modC = bigvalue_modB[0:30] + 'C' + bigvalue_modB[31:]
self.check(bigvalue_modA, uri, nrows, 110)
self.check(bigvalue_modB, uri, nrows, 120)
self.check(bigvalue_modC, uri, nrows, 130)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_readonly02.py
12 issues
Line: 36
Column: 1
from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os, wiredtiger, wttest
class test_readonly02(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'table:test_readonly02'
create = True
create_params = 'key_format=i,value_format=i'
Reported by Pylint.
Line: 65
Column: 5
#
badcfg1 = 'log=(enabled,zero_fill=true)'
def setUpConnectionOpen(self, dir):
self.home = dir
rdonlydir = dir + '.rdonly'
#
# First time through check readonly on a non-existent database.
#
Reported by Pylint.
Line: 65
Column: 35
#
badcfg1 = 'log=(enabled,zero_fill=true)'
def setUpConnectionOpen(self, dir):
self.home = dir
rdonlydir = dir + '.rdonly'
#
# First time through check readonly on a non-existent database.
#
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: 36
Column: 1
from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os, wiredtiger, wttest
class test_readonly02(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'table:test_readonly02'
create = True
create_params = 'key_format=i,value_format=i'
Reported by Pylint.
Line: 36
Column: 1
from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os, wiredtiger, wttest
class test_readonly02(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'table:test_readonly02'
create = True
create_params = 'key_format=i,value_format=i'
Reported by Pylint.
Line: 36
Column: 1
from helper import copy_wiredtiger_home
from suite_subprocess import suite_subprocess
import os, wiredtiger, wttest
class test_readonly02(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'table:test_readonly02'
create = True
create_params = 'key_format=i,value_format=i'
Reported by Pylint.
Line: 38
Column: 1
from suite_subprocess import suite_subprocess
import os, wiredtiger, wttest
class test_readonly02(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'table:test_readonly02'
create = True
create_params = 'key_format=i,value_format=i'
entries = 10
Reported by Pylint.
Line: 38
Column: 1
from suite_subprocess import suite_subprocess
import os, wiredtiger, wttest
class test_readonly02(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'table:test_readonly02'
create = True
create_params = 'key_format=i,value_format=i'
entries = 10
Reported by Pylint.
Line: 87
Column: 5
conn = self.wiredtiger_open(dir, self.conn_params)
return conn
def check_unclean(self):
backup = "WT_COPYDIR"
copy_wiredtiger_home(self, self.home, backup, True)
msg = '/needs recovery/'
# 2. an unclean shutdown and reopening readonly
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
Reported by Pylint.
src/mongo/logv2/shared_access_fstream.cpp
12 issues
Line: 203
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ofstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessOfstream::Win32SharedAccessOfstream(const wchar_t* filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 211
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ofstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessOfstream::Win32SharedAccessOfstream(const std::string& filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 219
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ofstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessOfstream::Win32SharedAccessOfstream(const std::filesystem::path& filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 227
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ofstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessIfstream::Win32SharedAccessIfstream(const char* filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 235
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ifstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessIfstream::Win32SharedAccessIfstream(const wchar_t* filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 243
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ifstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessIfstream::Win32SharedAccessIfstream(const std::string& filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 251
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ifstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessIfstream::Win32SharedAccessIfstream(const std::filesystem::path& filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 259
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::ifstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessFstream::Win32SharedAccessFstream(const char* filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 267
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::fstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessFstream::Win32SharedAccessFstream(const wchar_t* filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
Line: 275
Column: 9
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
bool sharedWriteAccess)
: Win32SharedAccessFileDescriptor(filename, mode, sharedWriteAccess), std::fstream(_file) {
if (!_file)
setstate(failbit);
}
Win32SharedAccessFstream::Win32SharedAccessFstream(const std::string& filename,
std::ios_base::openmode mode,
bool sharedWriteAccess)
Reported by FlawFinder.
src/third_party/wiredtiger/src/support/err.c
12 issues
Line: 282
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (fprintf(stderr, "WiredTiger Error%s%s: ", error == 0 ? "" : ": ",
error == 0 ? "" : __wt_strerror(session, error, NULL, 0)) < 0)
WT_TRET(EIO);
if (vfprintf(stderr, fmt, ap) < 0)
WT_TRET(EIO);
if (fprintf(stderr, "\n") < 0)
WT_TRET(EIO);
if (fflush(stderr) != 0)
WT_TRET(EIO);
Reported by FlawFinder.
Line: 299
Column: 63
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
void
__wt_err_func(WT_SESSION_IMPL *session, int error, const char *func, int line, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((cold)) WT_GCC_FUNC_ATTRIBUTE((format(printf, 5, 6)))
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
va_list ap;
/*
Reported by FlawFinder.
Line: 319
Column: 63
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
void
__wt_errx_func(WT_SESSION_IMPL *session, const char *func, int line, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((cold)) WT_GCC_FUNC_ATTRIBUTE((format(printf, 4, 5)))
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
va_list ap;
/*
Reported by FlawFinder.
Line: 339
Column: 68
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
int
__wt_panic_func(WT_SESSION_IMPL *session, int error, const char *func, int line, const char *fmt,
...) WT_GCC_FUNC_ATTRIBUTE((cold)) WT_GCC_FUNC_ATTRIBUTE((format(printf, 5, 6)))
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_CONNECTION_IMPL *conn;
va_list ap;
Reported by FlawFinder.
Line: 424
Column: 33
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
int
__wt_ext_err_printf(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format(printf, 3, 4)))
{
WT_DECL_RET;
WT_SESSION_IMPL *session;
va_list ap;
Reported by FlawFinder.
Line: 445
Column: 33
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
void
__wt_verbose_worker(WT_SESSION_IMPL *session, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format(printf, 2, 3))) WT_GCC_FUNC_ATTRIBUTE((cold))
{
va_list ap;
va_start(ap, fmt);
WT_IGNORE_RET(__eventv(session, true, 0, NULL, 0, fmt, ap));
Reported by FlawFinder.
Line: 460
Column: 33
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
int
__wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_FUNC_ATTRIBUTE((cold))
WT_GCC_FUNC_ATTRIBUTE((format(printf, 2, 3)))
{
WT_DECL_ITEM(buf);
WT_DECL_RET;
WT_EVENT_HANDLER *handler;
WT_SESSION *wt_session;
Reported by FlawFinder.
Line: 486
Column: 33
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
int
__wt_ext_msg_printf(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format(printf, 3, 4)))
{
WT_DECL_ITEM(buf);
WT_DECL_RET;
WT_EVENT_HANDLER *handler;
WT_SESSION_IMPL *session;
Reported by FlawFinder.
Line: 96
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
* SECURITY:
* Buffer placed at the end of the stack in case snprintf overflows.
*/
char s[256];
if (__wt_snprintf(s, sizeof(s), "application %s event handler failed: %s", which,
__wt_strerror(session, error, NULL, 0)) != 0)
return;
Reported by FlawFinder.
Line: 177
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_EVENT_HANDLER *handler;
WT_SESSION *wt_session;
size_t len, remain;
char *p, tid[128];
const char *err, *prefix;
/*
* We're using a stack buffer because we want error messages no matter
* what, and allocating a WT_ITEM, or the memory it needs, might fail.
Reported by FlawFinder.
src/mongo/logv2/shared_access_fstream.h
12 issues
Line: 83
Column: 10
CWE codes:
362
// The Visual Studio extension that operates on FILE* does not have an open overload. Needs to
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
Reported by FlawFinder.
Line: 84
Column: 10
CWE codes:
362
// The Visual Studio extension that operates on FILE* does not have an open overload. Needs to
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
class Win32SharedAccessIfstream : private Win32SharedAccessFileDescriptor, public std::ifstream {
Reported by FlawFinder.
Line: 85
Column: 10
CWE codes:
362
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
class Win32SharedAccessIfstream : private Win32SharedAccessFileDescriptor, public std::ifstream {
public:
Reported by FlawFinder.
Line: 86
Column: 10
CWE codes:
362
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
class Win32SharedAccessIfstream : private Win32SharedAccessFileDescriptor, public std::ifstream {
public:
explicit Win32SharedAccessIfstream(const char* filename,
Reported by FlawFinder.
Line: 106
Column: 10
CWE codes:
362
// The Visual Studio extension that operates on FILE* does not have an open overload. Needs to
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
Reported by FlawFinder.
Line: 107
Column: 10
CWE codes:
362
// The Visual Studio extension that operates on FILE* does not have an open overload. Needs to
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
class Win32SharedAccessFstream : private Win32SharedAccessFileDescriptor, public std::fstream {
Reported by FlawFinder.
Line: 108
Column: 10
CWE codes:
362
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
class Win32SharedAccessFstream : private Win32SharedAccessFileDescriptor, public std::fstream {
public:
Reported by FlawFinder.
Line: 109
Column: 10
CWE codes:
362
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
class Win32SharedAccessFstream : private Win32SharedAccessFileDescriptor, public std::fstream {
public:
explicit Win32SharedAccessFstream(const char* filename,
Reported by FlawFinder.
Line: 129
Column: 10
CWE codes:
362
// The Visual Studio extension that operates on FILE* does not have an open overload. Needs to
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
Reported by FlawFinder.
Line: 130
Column: 10
CWE codes:
362
// The Visual Studio extension that operates on FILE* does not have an open overload. Needs to
// open with constructor.
void open(const char* filename, ios_base::openmode mode) = delete;
void open(const wchar_t* filename, ios_base::openmode mode) = delete;
void open(const std::string& filename, ios_base::openmode mode) = delete;
void open(const std::filesystem::path& filename, ios_base::openmode mode) = delete;
};
} // namespace mongo
Reported by FlawFinder.
src/third_party/boost/boost/xpressive/detail/core/state.hpp
12 issues
Line: 106
Column: 35
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
: noncopyable
{
typedef BidiIter iterator;
typedef core_access<BidiIter> access;
typedef detail::match_context<BidiIter> match_context;
typedef detail::results_extras<BidiIter> results_extras;
typedef detail::regex_impl<BidiIter> regex_impl;
typedef detail::matchable<BidiIter> matchable;
typedef xpressive::match_results<BidiIter> match_results;
Reported by FlawFinder.
Line: 164
Column: 51
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
this->init_(impl, what);
// move all the nested match_results structs into the match_results cache
this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
}
///////////////////////////////////////////////////////////////////////////////
// reset
void reset(match_results &what, regex_impl const &impl)
Reported by FlawFinder.
Line: 180
Column: 51
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
this->found_partial_match_ = false;
this->extras_->sub_match_stack_.unwind();
this->init_(impl, what);
this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
}
///////////////////////////////////////////////////////////////////////////////
// push_context
// called to prepare the state object for a regex match
Reported by FlawFinder.
Line: 192
Column: 44
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
match_context context = this->context_;
// create a new nested match_results for this regex
nested_results<BidiIter> &nested = access::get_nested_results(*context.results_ptr_);
match_results &what = this->extras_->results_cache_.append_new(nested);
// (re)initialize the match context
this->init_(impl, what);
Reported by FlawFinder.
Line: 220
Column: 48
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
this->uninit_(impl, what);
// send the match_results struct back to the cache
nested_results<BidiIter> &nested = access::get_nested_results(what);
this->extras_->results_cache_.reclaim_last(nested);
}
// restore the state
this->context_ = context;
Reported by FlawFinder.
Line: 227
Column: 54
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// restore the state
this->context_ = context;
match_results &results = *this->context_.results_ptr_;
this->sub_matches_ = access::get_sub_matches(access::get_sub_match_vector(results));
this->mark_count_ = results.size();
return success;
}
///////////////////////////////////////////////////////////////////////////////
Reported by FlawFinder.
Line: 227
Column: 30
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// restore the state
this->context_ = context;
match_results &results = *this->context_.results_ptr_;
this->sub_matches_ = access::get_sub_matches(access::get_sub_match_vector(results));
this->mark_count_ = results.size();
return success;
}
///////////////////////////////////////////////////////////////////////////////
Reported by FlawFinder.
Line: 238
Column: 54
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
{
std::swap(this->context_, context);
match_results &results = *this->context_.results_ptr_;
this->sub_matches_ = access::get_sub_matches(access::get_sub_match_vector(results));
this->mark_count_ = results.size();
}
// beginning of buffer
bool bos() const
Reported by FlawFinder.
Line: 238
Column: 30
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
{
std::swap(this->context_, context);
match_results &results = *this->context_.results_ptr_;
this->sub_matches_ = access::get_sub_matches(access::get_sub_match_vector(results));
this->mark_count_ = results.size();
}
// beginning of buffer
bool bos() const
Reported by FlawFinder.
Line: 296
Column: 9
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
this->sub_matches_ += impl.hidden_mark_count_;
// initialize the match_results struct
access::init_match_results(what, id, impl.traits_, this->sub_matches_, this->mark_count_, impl.named_marks_);
}
void uninit_(regex_impl const &impl, match_results &)
{
extras_->sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_);
Reported by FlawFinder.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_tags.py
12 issues
Line: 10
Column: 1
from testtools.tags import TagContext
class TestTags(TestCase):
def test_no_tags(self):
# A tag context has no tags initially.
tag_context = TagContext()
self.assertEqual(set(), tag_context.get_current_tags())
Reported by Pylint.
Line: 12
Column: 5
class TestTags(TestCase):
def test_no_tags(self):
# A tag context has no tags initially.
tag_context = TagContext()
self.assertEqual(set(), tag_context.get_current_tags())
def test_add_tag(self):
Reported by Pylint.
Line: 17
Column: 5
tag_context = TagContext()
self.assertEqual(set(), tag_context.get_current_tags())
def test_add_tag(self):
# A tag added with change_tags appears in get_current_tags.
tag_context = TagContext()
tag_context.change_tags(set(['foo']), set())
self.assertEqual(set(['foo']), tag_context.get_current_tags())
Reported by Pylint.
Line: 23
Column: 5
tag_context.change_tags(set(['foo']), set())
self.assertEqual(set(['foo']), tag_context.get_current_tags())
def test_add_tag_twice(self):
# Calling change_tags twice to add tags adds both tags to the current
# tags.
tag_context = TagContext()
tag_context.change_tags(set(['foo']), set())
tag_context.change_tags(set(['bar']), set())
Reported by Pylint.
Line: 32
Column: 5
self.assertEqual(
set(['foo', 'bar']), tag_context.get_current_tags())
def test_change_tags_returns_tags(self):
# change_tags returns the current tags. This is a convenience.
tag_context = TagContext()
tags = tag_context.change_tags(set(['foo']), set())
self.assertEqual(set(['foo']), tags)
Reported by Pylint.
Line: 38
Column: 5
tags = tag_context.change_tags(set(['foo']), set())
self.assertEqual(set(['foo']), tags)
def test_remove_tag(self):
# change_tags can remove tags from the context.
tag_context = TagContext()
tag_context.change_tags(set(['foo']), set())
tag_context.change_tags(set(), set(['foo']))
self.assertEqual(set(), tag_context.get_current_tags())
Reported by Pylint.
Line: 45
Column: 5
tag_context.change_tags(set(), set(['foo']))
self.assertEqual(set(), tag_context.get_current_tags())
def test_child_context(self):
# A TagContext can have a parent. If so, its tags are the tags of the
# parent at the moment of construction.
parent = TagContext()
parent.change_tags(set(['foo']), set())
child = TagContext(parent)
Reported by Pylint.
Line: 54
Column: 5
self.assertEqual(
parent.get_current_tags(), child.get_current_tags())
def test_add_to_child(self):
# Adding a tag to the child context doesn't affect the parent.
parent = TagContext()
parent.change_tags(set(['foo']), set())
child = TagContext(parent)
child.change_tags(set(['bar']), set())
Reported by Pylint.
Line: 63
Column: 5
self.assertEqual(set(['foo', 'bar']), child.get_current_tags())
self.assertEqual(set(['foo']), parent.get_current_tags())
def test_remove_in_child(self):
# A tag that was in the parent context can be removed from the child
# context without affect the parent.
parent = TagContext()
parent.change_tags(set(['foo']), set())
child = TagContext(parent)
Reported by Pylint.
Line: 73
Column: 5
self.assertEqual(set(), child.get_current_tags())
self.assertEqual(set(['foo']), parent.get_current_tags())
def test_parent(self):
# The parent can be retrieved from a child context.
parent = TagContext()
parent.change_tags(set(['foo']), set())
child = TagContext(parent)
child.change_tags(set(), set(['foo']))
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_util12.py
12 issues
Line: 31
Column: 1
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_util12.py
# Utilities: wt write
class test_util12(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_util12.a'
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_util12.py
# Utilities: wt write
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_util12.py
# Utilities: wt write
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_util12.py
# Utilities: wt write
Reported by Pylint.
Line: 31
Column: 1
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_util12.py
# Utilities: wt write
class test_util12(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_util12.a'
Reported by Pylint.
Line: 31
Column: 1
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_util12.py
# Utilities: wt write
class test_util12(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_util12.a'
Reported by Pylint.
Line: 35
Column: 1
# test_util12.py
# Utilities: wt write
class test_util12(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_util12.a'
session_params = 'key_format=S,value_format=S'
def test_write(self):
self.session.create('table:' + self.tablename, self.session_params)
Reported by Pylint.
Line: 35
Column: 1
# test_util12.py
# Utilities: wt write
class test_util12(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_util12.a'
session_params = 'key_format=S,value_format=S'
def test_write(self):
self.session.create('table:' + self.tablename, self.session_params)
Reported by Pylint.
Line: 39
Column: 5
tablename = 'test_util12.a'
session_params = 'key_format=S,value_format=S'
def test_write(self):
self.session.create('table:' + self.tablename, self.session_params)
self.runWt(['write', 'table:' + self.tablename,
'def', '456', 'abc', '123'])
cursor = self.session.open_cursor('table:' + self.tablename, None, None)
self.assertEqual(cursor.next(), 0)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_bug013.py
11 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
# test_bug013.py
# Test data consistency in LSM with updates. Ensure that overwrite
# cursors see all entries in the tree (i.e: they open cursors on all
# chunks in the LSM tree).
Reported by Pylint.
Line: 46
Column: 25
# Test by iterating.
cursor = self.session.open_cursor(self.uri, None, None)
i = 0
for i1, i2, i3, v1 in cursor:
self.assertEqual( keys[i], [i1, i2, i3])
i += 1
cursor.close()
self.assertEqual(i, len(keys))
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 wiredtiger, wttest
# test_bug013.py
# Test data consistency in LSM with updates. Ensure that overwrite
# cursors see all entries in the tree (i.e: they open cursors on all
# chunks in the LSM tree).
Reported by Pylint.
Line: 36
Column: 1
# cursors see all entries in the tree (i.e: they open cursors on all
# chunks in the LSM tree).
# See JIRA BF-829
class test_bug013(wttest.WiredTigerTestCase):
"""
Test LSM data consistency.
"""
uri = 'table:test_bug013'
Reported by Pylint.
Line: 42
Column: 5
"""
uri = 'table:test_bug013'
def check_entries(self, keys):
# Test by iterating.
cursor = self.session.open_cursor(self.uri, None, None)
i = 0
for i1, i2, i3, v1 in cursor:
self.assertEqual( keys[i], [i1, i2, i3])
Reported by Pylint.
Line: 46
Column: 17
# Test by iterating.
cursor = self.session.open_cursor(self.uri, None, None)
i = 0
for i1, i2, i3, v1 in cursor:
self.assertEqual( keys[i], [i1, i2, i3])
i += 1
cursor.close()
self.assertEqual(i, len(keys))
Reported by Pylint.
Line: 46
Column: 21
# Test by iterating.
cursor = self.session.open_cursor(self.uri, None, None)
i = 0
for i1, i2, i3, v1 in cursor:
self.assertEqual( keys[i], [i1, i2, i3])
i += 1
cursor.close()
self.assertEqual(i, len(keys))
Reported by Pylint.
Line: 46
Column: 25
# Test by iterating.
cursor = self.session.open_cursor(self.uri, None, None)
i = 0
for i1, i2, i3, v1 in cursor:
self.assertEqual( keys[i], [i1, i2, i3])
i += 1
cursor.close()
self.assertEqual(i, len(keys))
Reported by Pylint.
Line: 46
Column: 13
# Test by iterating.
cursor = self.session.open_cursor(self.uri, None, None)
i = 0
for i1, i2, i3, v1 in cursor:
self.assertEqual( keys[i], [i1, i2, i3])
i += 1
cursor.close()
self.assertEqual(i, len(keys))
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_debug_mode01.py
11 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
# test_debug_mode01.py
# Test the debug mode settings. Test rollback_error in this one.
class test_debug_mode01(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled=true),debug_mode=(rollback_error=5)'
Reported by Pylint.
Line: 60
Column: 21
# conflict exception is raised, false if no exception occurred.
if insert:
conflict = self.assertRaisesException(wiredtiger.WiredTigerError, \
lambda:c.insert(), msg, True)
else:
conflict = self.assertRaisesException(wiredtiger.WiredTigerError, \
lambda:c.update(), msg, True)
if conflict:
Reported by Pylint.
Line: 63
Column: 21
lambda:c.insert(), msg, True)
else:
conflict = self.assertRaisesException(wiredtiger.WiredTigerError, \
lambda:c.update(), msg, True)
if conflict:
rollback += 1
self.pr("Key: " + str(k) + " Rolled back")
self.session.rollback_transaction()
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 wiredtiger, wttest
# test_debug_mode01.py
# Test the debug mode settings. Test rollback_error in this one.
class test_debug_mode01(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled=true),debug_mode=(rollback_error=5)'
Reported by Pylint.
Line: 33
Column: 1
# test_debug_mode01.py
# Test the debug mode settings. Test rollback_error in this one.
class test_debug_mode01(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled=true),debug_mode=(rollback_error=5)'
session_config = 'isolation=snapshot'
uri = 'file:test_debug'
entries = 22
Reported by Pylint.
Line: 33
Column: 1
# test_debug_mode01.py
# Test the debug mode settings. Test rollback_error in this one.
class test_debug_mode01(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled=true),debug_mode=(rollback_error=5)'
session_config = 'isolation=snapshot'
uri = 'file:test_debug'
entries = 22
Reported by Pylint.
Line: 41
Column: 5
entries = 22
min_error = entries // 5
def rollback_error(self, val, insert=True):
keys = range(1, self.entries)
c = self.session.open_cursor(self.uri, None)
# We expect some operations to return an exception so we cannot
# use the simple 'c[k] = 1'. But we must explicitly set the key
# and value and then use the insert or update primitives.
Reported by Pylint.
Line: 43
Column: 9
def rollback_error(self, val, insert=True):
keys = range(1, self.entries)
c = self.session.open_cursor(self.uri, None)
# We expect some operations to return an exception so we cannot
# use the simple 'c[k] = 1'. But we must explicitly set the key
# and value and then use the insert or update primitives.
#
# Look for a generic 'WT_ROLLBACK' string not the specific
Reported by Pylint.
Line: 74
Column: 5
c.close()
return rollback
def test_rollback_error(self):
self.session.create(self.uri, 'key_format=i,value_format=i')
rollback = self.rollback_error(1)
rollback += self.rollback_error(2, False)
self.pr("Rollback: " + str(rollback))
self.pr("Minimum: " + str(self.min_error))
Reported by Pylint.