The following issues were found
src/third_party/wiredtiger/test/suite/test_bug003.py
8 issues
Line: 32
Column: 1
# test_bug003.py
# Regression tests.
import wiredtiger, wttest
from wtscenario import make_scenarios
# Regression tests.
class test_bug003(wttest.WiredTigerTestCase):
types = [
Reported by Pylint.
Line: 32
Column: 1
# test_bug003.py
# Regression tests.
import wiredtiger, wttest
from wtscenario import make_scenarios
# Regression tests.
class test_bug003(wttest.WiredTigerTestCase):
types = [
Reported by Pylint.
Line: 55
Column: 9
self.session.checkpoint("name=ckpt")
else:
self.session.checkpoint()
cursor = self.session.open_cursor(self.uri, None, "bulk")
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: 32
Column: 1
# test_bug003.py
# Regression tests.
import wiredtiger, wttest
from wtscenario import make_scenarios
# Regression tests.
class test_bug003(wttest.WiredTigerTestCase):
types = [
Reported by Pylint.
Line: 36
Column: 1
from wtscenario import make_scenarios
# Regression tests.
class test_bug003(wttest.WiredTigerTestCase):
types = [
('file', dict(uri='file:data')),
('table', dict(uri='table:data')),
]
ckpt = [
Reported by Pylint.
Line: 36
Column: 1
from wtscenario import make_scenarios
# Regression tests.
class test_bug003(wttest.WiredTigerTestCase):
types = [
('file', dict(uri='file:data')),
('table', dict(uri='table:data')),
]
ckpt = [
Reported by Pylint.
Line: 49
Column: 5
scenarios = make_scenarios(types, ckpt)
# Confirm bulk-load isn't stopped by checkpoints.
def test_bug003(self):
self.session.create(self.uri, "key_format=S,value_format=S")
if self.name == 1:
self.session.checkpoint("name=ckpt")
else:
self.session.checkpoint()
Reported by Pylint.
src/third_party/boost/libs/log/src/windows/ipc_reliable_message_queue.cpp
8 issues
Line: 101
Column: 18
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
//! A tag value to ensure the correct binary layout of the message queue data structures. Must be placed first and always have a fixed size and alignment.
uint32_t m_abi_tag;
//! Padding to protect against alignment changes in Boost.Atomic. Don't use BOOST_ALIGNMENT to ensure portability.
unsigned char m_padding[BOOST_LOG_CPU_CACHE_LINE_SIZE - sizeof(uint32_t)];
//! A flag indicating that the queue is constructed (i.e. the queue is constructed when the value is not 0).
boost::atomic< uint32_t > m_initialized;
//! Number of allocation blocks in the queue.
const uint32_t m_capacity;
//! Size of an allocation block, in bytes.
Reported by FlawFinder.
Line: 267
Column: 25
CWE codes:
362
m_name(name)
{
const std::wstring wname = boost::log::aux::utf8_to_utf16(name.c_str());
m_shared_memory.open(wname.c_str());
m_shared_memory.map();
adopt_queue(wname, m_shared_memory.size(), perms);
}
Reported by FlawFinder.
Line: 497
Column: 17
CWE codes:
362
if (!boost::log::aux::is_power_of_2(hdr->m_block_size))
BOOST_LOG_THROW_DESCR(setup_error, "Boost.Log interprocess message queue cannot be opened: the queue block size is not a power of 2");
m_mutex.open((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".mutex").c_str(), &hdr->m_mutex_state);
m_nonempty_queue.open((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonempty_queue_event").c_str());
m_nonfull_queue.init((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonfull_queue_cond_var").c_str(), &hdr->m_nonfull_queue_state, perms);
create_stop_event();
init_block_size(hdr->m_block_size);
Reported by FlawFinder.
Line: 498
Column: 26
CWE codes:
362
BOOST_LOG_THROW_DESCR(setup_error, "Boost.Log interprocess message queue cannot be opened: the queue block size is not a power of 2");
m_mutex.open((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".mutex").c_str(), &hdr->m_mutex_state);
m_nonempty_queue.open((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonempty_queue_event").c_str());
m_nonfull_queue.init((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonfull_queue_cond_var").c_str(), &hdr->m_nonfull_queue_state, perms);
create_stop_event();
init_block_size(hdr->m_block_size);
}
Reported by FlawFinder.
Line: 571
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
block->m_size = message_size;
size_type write_size = (std::min)(static_cast< size_type >((capacity - pos) * block_size - block_header::get_header_overhead()), message_size);
std::memcpy(block->get_data(), message_data, write_size);
pos += block_count;
if (BOOST_UNLIKELY(pos >= capacity))
{
// Write the rest of the message at the beginning of the queue
Reported by FlawFinder.
Line: 581
Column: 22
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
message_data = static_cast< const unsigned char* >(message_data) + write_size;
write_size = message_size - write_size;
if (write_size > 0u)
std::memcpy(hdr->get_block(0u), message_data, write_size);
}
hdr->m_put_pos = pos;
const uint32_t old_queue_size = hdr->m_size;
Reported by FlawFinder.
Line: 659
Column: 44
CWE codes:
362
}
}
BOOST_LOG_API void reliable_message_queue::open(object_name const& name, overflow_policy oflow_policy, permissions const& perms)
{
BOOST_ASSERT(m_impl == NULL);
try
{
m_impl = new implementation(open_mode::open_only, name, oflow_policy, perms);
Reported by FlawFinder.
Line: 802
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (BOOST_UNLIKELY(size > p->size))
BOOST_THROW_EXCEPTION(bad_alloc("Buffer too small to receive the message"));
std::memcpy(p->data, data, size);
p->data += size;
p->size -= size;
}
BOOST_LOG_API void reliable_message_queue::remove(object_name const&)
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_huffman02.py
8 issues
Line: 36
Column: 1
import os
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest
# test_huffman02.py
# Huffman key and value configurations test.
class test_huffman02(wttest.WiredTigerTestCase, suite_subprocess):
huffval = [
Reported by Pylint.
Line: 33
Column: 1
# huffman_encoding
# [END_TAGS]
import os
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest
# test_huffman02.py
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
import os
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest
# test_huffman02.py
# Huffman key and value configurations test.
class test_huffman02(wttest.WiredTigerTestCase, suite_subprocess):
huffval = [
Reported by Pylint.
Line: 36
Column: 1
import os
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest
# test_huffman02.py
# Huffman key and value configurations test.
class test_huffman02(wttest.WiredTigerTestCase, suite_subprocess):
huffval = [
Reported by Pylint.
Line: 40
Column: 1
# test_huffman02.py
# Huffman key and value configurations test.
class test_huffman02(wttest.WiredTigerTestCase, suite_subprocess):
huffval = [
('bad', dict(valbad=1,huffval=',huffman_value=bad')),
('english', dict(valbad=0,huffval=',huffman_value=english')),
('none', dict(valbad=0,huffval=',huffman_value=english')),
]
Reported by Pylint.
Line: 40
Column: 1
# test_huffman02.py
# Huffman key and value configurations test.
class test_huffman02(wttest.WiredTigerTestCase, suite_subprocess):
huffval = [
('bad', dict(valbad=1,huffval=',huffman_value=bad')),
('english', dict(valbad=0,huffval=',huffman_value=english')),
('none', dict(valbad=0,huffval=',huffman_value=english')),
]
Reported by Pylint.
Line: 52
Column: 5
]
scenarios = make_scenarios(type, huffval)
def test_huffman(self):
if self.valbad:
msg = '/Invalid argument/'
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda:
self.session.create(self.uri, self.huffval), msg)
else:
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/cxx.py
8 issues
Line: 63
Column: 5
Add Builders and construction variables for Visual Age C++ compilers
to an Environment.
"""
import SCons.Tool
import SCons.Tool.cc
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in CXXSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CXXAction)
Reported by Pylint.
Line: 63
Column: 5
Add Builders and construction variables for Visual Age C++ compilers
to an Environment.
"""
import SCons.Tool
import SCons.Tool.cc
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in CXXSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CXXAction)
Reported by Pylint.
Line: 33
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/cxx.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import os.path
import SCons.Tool
import SCons.Defaults
Reported by Pylint.
Line: 47
Column: 1
if SCons.Util.case_sensitive_suffixes('.c', '.C'):
CXXSuffixes.append('.C')
def iscplusplus(source):
if not source:
# Source might be None for unusual cases like SConf.
return 0
for s in source:
if s.sources:
Reported by Pylint.
Line: 51
Column: 9
if not source:
# Source might be None for unusual cases like SConf.
return 0
for s in source:
if s.sources:
ext = os.path.splitext(str(s.sources[0]))[1]
if ext in CXXSuffixes:
return 1
return 0
Reported by Pylint.
Line: 63
Column: 5
Add Builders and construction variables for Visual Age C++ compilers
to an Environment.
"""
import SCons.Tool
import SCons.Tool.cc
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in CXXSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CXXAction)
Reported by Pylint.
Line: 64
Column: 5
to an Environment.
"""
import SCons.Tool
import SCons.Tool.cc
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in CXXSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CXXAction)
shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction)
Reported by Pylint.
Line: 93
Column: 1
env['CXXFILESUFFIX'] = '.cc'
def exists(env):
return env.Detect(env.get('CXX', compilers))
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
Reported by Pylint.
src/mongo/db/exec/working_set.cpp
8 issues
Line: 264
Column: 47
CWE codes:
120
20
WorkingSetMember wsm;
// First decode the state, which instructs us on how to interpret the rest of the buffer.
wsm._state = static_cast<MemberState>(buf.read<char>());
if (wsm.hasObj()) {
wsm.doc.setValue(
Document::deserializeForSorter(buf, Document::SorterDeserializeSettings{}));
auto snapshotIdRepr = buf.read<LittleEndian<uint64_t>>();
Reported by FlawFinder.
Line: 269
Column: 35
CWE codes:
120
20
if (wsm.hasObj()) {
wsm.doc.setValue(
Document::deserializeForSorter(buf, Document::SorterDeserializeSettings{}));
auto snapshotIdRepr = buf.read<LittleEndian<uint64_t>>();
auto snapshotId = snapshotIdRepr ? SnapshotId{snapshotIdRepr} : SnapshotId{};
wsm.doc.setSnapshotId(snapshotId);
}
if (wsm.getState() == WorkingSetMember::RID_AND_IDX) {
Reported by FlawFinder.
Line: 275
Column: 28
CWE codes:
120
20
}
if (wsm.getState() == WorkingSetMember::RID_AND_IDX) {
auto numKeys = buf.read<char>();
wsm.keyData.reserve(numKeys);
for (auto i = 0; i < numKeys; ++i) {
auto indexKeyPattern =
BSONObj::deserializeForSorter(buf, BSONObj::SorterDeserializeSettings{}).getOwned();
auto indexKey =
Reported by FlawFinder.
Line: 282
Column: 32
CWE codes:
120
20
BSONObj::deserializeForSorter(buf, BSONObj::SorterDeserializeSettings{}).getOwned();
auto indexKey =
BSONObj::deserializeForSorter(buf, BSONObj::SorterDeserializeSettings{}).getOwned();
auto indexId = buf.read<LittleEndian<unsigned int>>();
auto snapshotIdRepr = buf.read<LittleEndian<uint64_t>>();
auto snapshotId = snapshotIdRepr ? SnapshotId{snapshotIdRepr} : SnapshotId{};
wsm.keyData.push_back(IndexKeyDatum{
std::move(indexKeyPattern), std::move(indexKey), indexId, snapshotId});
}
Reported by FlawFinder.
Line: 283
Column: 39
CWE codes:
120
20
auto indexKey =
BSONObj::deserializeForSorter(buf, BSONObj::SorterDeserializeSettings{}).getOwned();
auto indexId = buf.read<LittleEndian<unsigned int>>();
auto snapshotIdRepr = buf.read<LittleEndian<uint64_t>>();
auto snapshotId = snapshotIdRepr ? SnapshotId{snapshotIdRepr} : SnapshotId{};
wsm.keyData.push_back(IndexKeyDatum{
std::move(indexKeyPattern), std::move(indexKey), indexId, snapshotId});
}
}
Reported by FlawFinder.
Line: 292
Column: 73
CWE codes:
120
20
if (wsm.hasRecordId()) {
// The RecordId data format informs us how to interpret the RecordId in the buffer.
RecordIdFormat recordIdFormat = static_cast<RecordIdFormat>(buf.read<char>());
if (recordIdFormat == RecordIdFormat::Long) {
wsm.recordId = RecordId{buf.read<LittleEndian<int64_t>>()};
} else {
invariant(recordIdFormat == RecordIdFormat::String);
auto size = buf.read<LittleEndian<int32_t>>();
Reported by FlawFinder.
Line: 294
Column: 41
CWE codes:
120
20
// The RecordId data format informs us how to interpret the RecordId in the buffer.
RecordIdFormat recordIdFormat = static_cast<RecordIdFormat>(buf.read<char>());
if (recordIdFormat == RecordIdFormat::Long) {
wsm.recordId = RecordId{buf.read<LittleEndian<int64_t>>()};
} else {
invariant(recordIdFormat == RecordIdFormat::String);
auto size = buf.read<LittleEndian<int32_t>>();
const char* recordIdStr = static_cast<const char*>(buf.skip(size));
wsm.recordId = RecordId{recordIdStr, size};
Reported by FlawFinder.
Line: 297
Column: 29
CWE codes:
120
20
wsm.recordId = RecordId{buf.read<LittleEndian<int64_t>>()};
} else {
invariant(recordIdFormat == RecordIdFormat::String);
auto size = buf.read<LittleEndian<int32_t>>();
const char* recordIdStr = static_cast<const char*>(buf.skip(size));
wsm.recordId = RecordId{recordIdStr, size};
}
}
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_backup15.py
8 issues
Line: 89
Column: 9
def test_backup15(self):
os.mkdir(self.bkp_home)
self.home = self.bkp_home
self.session.create(self.uri, "key_format=S,value_format=S")
self.setup_directories(self.home_incr, self.home_full)
self.pr('*** Add data, checkpoint, take backups and validate ***')
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
# test_backup15.py
# Test cursor backup with a block-based incremental cursor.
class test_backup15(backup_base):
bkp_home = "WT_BLOCK"
bkup_id=0
conn_config='cache_size=1G,log=(enabled,file_max=100K)'
logmax="100K"
max_iteration=5
Reported by Pylint.
Line: 33
Column: 1
# test_backup15.py
# Test cursor backup with a block-based incremental cursor.
class test_backup15(backup_base):
bkp_home = "WT_BLOCK"
bkup_id=0
conn_config='cache_size=1G,log=(enabled,file_max=100K)'
logmax="100K"
max_iteration=5
Reported by Pylint.
Line: 60
Column: 5
#
# Add data to the given uri.
#
def add_complex_data(self, uri):
c = self.session.open_cursor(uri, None, None)
# The first time we want to add in a lot of data. Then after that we want to
# rapidly change a single key to create a hotspot in one block.
if self.savefirst < 2:
nops = self.nops
Reported by Pylint.
Line: 61
Column: 9
# Add data to the given uri.
#
def add_complex_data(self, uri):
c = self.session.open_cursor(uri, None, None)
# The first time we want to add in a lot of data. Then after that we want to
# rapidly change a single key to create a hotspot in one block.
if self.savefirst < 2:
nops = self.nops
else:
Reported by Pylint.
Line: 84
Column: 12
# Increase the multiplier so that later calls insert unique items.
self.mult += 1
# Increase the counter so that later backups have unique ids.
if self.initial_backup == False:
self.bkup_id += 1
def test_backup15(self):
os.mkdir(self.bkp_home)
self.home = self.bkp_home
Reported by Pylint.
Line: 87
Column: 5
if self.initial_backup == False:
self.bkup_id += 1
def test_backup15(self):
os.mkdir(self.bkp_home)
self.home = self.bkp_home
self.session.create(self.uri, "key_format=S,value_format=S")
self.setup_directories(self.home_incr, self.home_full)
Reported by Pylint.
src/third_party/boost/boost/spirit/home/classic/utility/confix.hpp
8 issues
Line: 61
Column: 7
CWE codes:
362
self_t;
confix_parser(OpenT const &open_, ExprT const &expr_, CloseT const &close_)
: open(open_), expr(expr_), close(close_)
{}
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
Reported by FlawFinder.
Line: 69
Column: 54
CWE codes:
362
parse(ScannerT const& scan) const
{
return impl::confix_parser_type<CategoryT>::
parse(NestedT(), LexemeT(), *this, scan, open, expr, close);
}
private:
typename as_parser<OpenT>::type::embed_t open;
Reported by FlawFinder.
Line: 74
Column: 46
CWE codes:
362
private:
typename as_parser<OpenT>::type::embed_t open;
typename as_parser<ExprT>::type::embed_t expr;
typename as_parser<CloseT>::type::embed_t close;
};
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
Reported by FlawFinder.
Line: 345
Column: 9
CWE codes:
362
typedef comment_nest_parser<OpenT, CloseT> self_t;
comment_nest_parser(OpenT const &open_, CloseT const &close_):
open(open_), close(close_)
{}
template<typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const &scan) const
Reported by FlawFinder.
Line: 353
Column: 13
CWE codes:
362
parse(ScannerT const &scan) const
{
return do_parse(
open >> *(*this | (anychar_p - close)) >> close,
scan);
}
private:
template<typename ParserT, typename ScannerT>
Reported by FlawFinder.
Line: 368
Column: 46
CWE codes:
362
>(p, scan, scan);
}
typename as_parser<OpenT>::type::embed_t open;
typename as_parser<CloseT>::type::embed_t close;
};
///////////////////////////////////////////////////////////////////////////////
//
Reported by FlawFinder.
Line: 389
Column: 29
CWE codes:
362
template<typename OpenT, typename CloseT>
inline typename comment_nest_p_result<OpenT,CloseT>::type
comment_nest_p(OpenT const &open, CloseT const &close)
{
typedef typename comment_nest_p_result<OpenT,CloseT>::type
result_t;
return result_t(
Reported by FlawFinder.
Line: 395
Column: 35
CWE codes:
362
result_t;
return result_t(
as_parser<OpenT>::convert(open),
as_parser<CloseT>::convert(close)
);
}
///////////////////////////////////////////////////////////////////////////////
Reported by FlawFinder.
jstests/ocsp/lib/ocsp_mock.py
8 issues
Line: 13
Column: 1
sys.path.append(os.path.join(os.getcwd() ,'src', 'third_party', 'mock_ocsp_responder'))
import mock_ocsp_responder
def main():
"""Main entry point"""
parser = argparse.ArgumentParser(description="MongoDB Mock OCSP Responder.")
Reported by Pylint.
Line: 13
Column: 1
sys.path.append(os.path.join(os.getcwd() ,'src', 'third_party', 'mock_ocsp_responder'))
import mock_ocsp_responder
def main():
"""Main entry point"""
parser = argparse.ArgumentParser(description="MongoDB Mock OCSP Responder.")
Reported by Pylint.
Line: 27
Column: 1
parser.add_argument('-v', '--verbose', action='count', help="Enable verbose tracing")
parser.add_argument('--ocsp_responder_cert', type=str, required=True, help="OCSP Responder Certificate")
parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile")
parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")
Reported by Pylint.
Line: 29
Column: 1
parser.add_argument('--ocsp_responder_cert', type=str, required=True, help="OCSP Responder Certificate")
parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile")
parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")
parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")
Reported by Pylint.
Line: 31
Column: 1
parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile")
parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")
parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")
parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds")
Reported by Pylint.
Line: 33
Column: 1
parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")
parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")
parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds")
args = parser.parse_args()
if args.verbose:
Reported by Pylint.
Line: 35
Column: 1
parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")
parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds")
args = parser.parse_args()
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
Reported by Pylint.
Line: 42
Column: 1
logging.basicConfig(level=logging.DEBUG)
print('Initializing OCSP Responder')
mock_ocsp_responder.init_responder(issuer_cert=args.ca_file, responder_cert=args.ocsp_responder_cert, responder_key=args.ocsp_responder_key, fault=args.fault, next_update_seconds=args.next_update_seconds, response_delay_seconds=args.response_delay_seconds)
mock_ocsp_responder.init(port=args.port, debug=args.verbose, host=args.bind_ip)
print('Mock OCSP Responder is running on port %s' % (str(args.port)))
Reported by Pylint.
src/mongo/bson/util/simple8b_type_util.cpp
8 issues
Line: 86
Column: 14
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
}
OID Simple8bTypeUtil::decodeObjectId(int64_t val, OID::InstanceUnique processUnique) {
unsigned char objId[OID::kOIDSize];
val = LittleEndian<uint64_t>::store(val);
uint8_t* encodedBytes = reinterpret_cast<uint8_t*>(&val);
// Set Timestamp and Counter variables together.
Reported by FlawFinder.
Line: 74
Column: 27
CWE codes:
120
20
ConstDataView cdv = oid.view();
// Copy counter and timestamp bytes so that they match the specs in the header.
encodedBytes[0] = cdv.read<uint8_t>(3); // Timestamp index 3.
encodedBytes[1] = cdv.read<uint8_t>(11); // Counter index 2.
encodedBytes[2] = cdv.read<uint8_t>(2); // Timestamp index 2.
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
Reported by FlawFinder.
Line: 75
Column: 27
CWE codes:
120
20
// Copy counter and timestamp bytes so that they match the specs in the header.
encodedBytes[0] = cdv.read<uint8_t>(3); // Timestamp index 3.
encodedBytes[1] = cdv.read<uint8_t>(11); // Counter index 2.
encodedBytes[2] = cdv.read<uint8_t>(2); // Timestamp index 2.
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
encodedBytes[6] = cdv.read<uint8_t>(0); // Timestamp index 0.
Reported by FlawFinder.
Line: 76
Column: 27
CWE codes:
120
20
// Copy counter and timestamp bytes so that they match the specs in the header.
encodedBytes[0] = cdv.read<uint8_t>(3); // Timestamp index 3.
encodedBytes[1] = cdv.read<uint8_t>(11); // Counter index 2.
encodedBytes[2] = cdv.read<uint8_t>(2); // Timestamp index 2.
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
encodedBytes[6] = cdv.read<uint8_t>(0); // Timestamp index 0.
Reported by FlawFinder.
Line: 77
Column: 27
CWE codes:
120
20
encodedBytes[0] = cdv.read<uint8_t>(3); // Timestamp index 3.
encodedBytes[1] = cdv.read<uint8_t>(11); // Counter index 2.
encodedBytes[2] = cdv.read<uint8_t>(2); // Timestamp index 2.
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
encodedBytes[6] = cdv.read<uint8_t>(0); // Timestamp index 0.
return LittleEndian<uint64_t>::load(encoded);
Reported by FlawFinder.
Line: 78
Column: 27
CWE codes:
120
20
encodedBytes[1] = cdv.read<uint8_t>(11); // Counter index 2.
encodedBytes[2] = cdv.read<uint8_t>(2); // Timestamp index 2.
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
encodedBytes[6] = cdv.read<uint8_t>(0); // Timestamp index 0.
return LittleEndian<uint64_t>::load(encoded);
}
Reported by FlawFinder.
Line: 79
Column: 27
CWE codes:
120
20
encodedBytes[2] = cdv.read<uint8_t>(2); // Timestamp index 2.
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
encodedBytes[6] = cdv.read<uint8_t>(0); // Timestamp index 0.
return LittleEndian<uint64_t>::load(encoded);
}
Reported by FlawFinder.
Line: 80
Column: 27
CWE codes:
120
20
encodedBytes[3] = cdv.read<uint8_t>(10); // Counter index 1.
encodedBytes[4] = cdv.read<uint8_t>(1); // Timestamp index 1.
encodedBytes[5] = cdv.read<uint8_t>(9); // Counter index 0.
encodedBytes[6] = cdv.read<uint8_t>(0); // Timestamp index 0.
return LittleEndian<uint64_t>::load(encoded);
}
OID Simple8bTypeUtil::decodeObjectId(int64_t val, OID::InstanceUnique processUnique) {
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/suite_random.py
8 issues
Line: 60
Column: 28
w = self.seedw
z = self.seedz
if w == 0 or z == 0:
seedw, seedz = wttest.getRandomSeed()
self.seedw = int(seedw) & 0xffffffff
self.seedz = int(seedz) & 0xffffffff
self.seedz = (36969 * (z & 65535) + (z >> 16)) & 0xffffffff
self.seedw = (18000 * (w & 65535) + (w >> 16)) & 0xffffffff
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
# A quick and predictable pseudo random number generator.
import wttest
class suite_random:
"""
Generate random 32 bit integers that are predictable,
and use no global state. We use the Multiply-with-carry
method invented by George Marsaglia, because it is quick
and easy to implement.
Reported by Pylint.
Line: 57
Column: 9
"""
returns a random 32 bit integer
"""
w = self.seedw
z = self.seedz
if w == 0 or z == 0:
seedw, seedz = wttest.getRandomSeed()
self.seedw = int(seedw) & 0xffffffff
self.seedz = int(seedz) & 0xffffffff
Reported by Pylint.
Line: 58
Column: 9
returns a random 32 bit integer
"""
w = self.seedw
z = self.seedz
if w == 0 or z == 0:
seedw, seedz = wttest.getRandomSeed()
self.seedw = int(seedw) & 0xffffffff
self.seedz = int(seedz) & 0xffffffff
Reported by Pylint.
Line: 68
Column: 5
self.seedw = (18000 * (w & 65535) + (w >> 16)) & 0xffffffff
return ((z << 16) + (w & 65535)) & 0xffffffff
def rand_range(self, n, m):
"""
returns a random integer in the range [N,M).
"""
if m > 0xffffffff or n < 0:
raise ValueError("rand32_range expects args between 0 , 2^32")
Reported by Pylint.
Line: 68
Column: 5
self.seedw = (18000 * (w & 65535) + (w >> 16)) & 0xffffffff
return ((z << 16) + (w & 65535)) & 0xffffffff
def rand_range(self, n, m):
"""
returns a random integer in the range [N,M).
"""
if m > 0xffffffff or n < 0:
raise ValueError("rand32_range expects args between 0 , 2^32")
Reported by Pylint.
Line: 76
Column: 9
raise ValueError("rand32_range expects args between 0 , 2^32")
if n >= m:
raise ValueError("rand32_range(n,m) expects n < m")
r = self.rand32()
return (r % (m - n)) + n
def rand_float(self):
"""
returns a random floating point value between 0 and 1.0
Reported by Pylint.