The following issues were found
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/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.
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/boost/boost/random/linear_congruential.hpp
8 issues
Line: 36
Column: 11
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
#include <boost/random/detail/disable_warnings.hpp>
namespace boost {
namespace random {
/**
* Instantiations of class template linear_congruential_engine model a
* \pseudo_random_number_generator. Linear congruential pseudo-random
* number generators are described in:
Reported by FlawFinder.
Line: 269
Column: 20
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
if(x >= (min)() && x <= (max)()) {
_x = x;
} else {
is.setstate(std::ios_base::failbit);
}
}
}
/// \endcond
Reported by FlawFinder.
Line: 446
Column: 13
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
{ return !(x == y); }
private:
/// \cond show_private
typedef random::linear_congruential_engine<uint64_t,
// xxxxULL is not portable
uint64_t(0xDEECE66DUL) | (uint64_t(0x5) << 32),
0xB, uint64_t(1)<<48> lcf_t;
lcf_t lcf;
Reported by FlawFinder.
Line: 460
Column: 7
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
} // namespace random
using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;
} // namespace boost
Reported by FlawFinder.
Line: 461
Column: 7
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
} // namespace random
using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;
} // namespace boost
#include <boost/random/detail/enable_warnings.hpp>
Reported by FlawFinder.
Line: 462
Column: 7
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;
} // namespace boost
#include <boost/random/detail/enable_warnings.hpp>
Reported by FlawFinder.
Line: 263
Column: 10
CWE codes:
120
20
/// \cond show_private
template<class CharT, class Traits>
void read(std::basic_istream<CharT, Traits>& is) {
IntType x;
if(is >> x) {
if(x >= (min)() && x <= (max)()) {
_x = x;
} else {
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/virtualenv.py
8 issues
Line: 29
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/virtualenv.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import os
import sys
import SCons.Util
Reported by Pylint.
Line: 36
Column: 1
import SCons.Util
virtualenv_enabled_by_default = False
def _enable_virtualenv_default():
return SCons.Util.get_os_env_bool('SCONS_ENABLE_VIRTUALENV', virtualenv_enabled_by_default)
Reported by Pylint.
Line: 63
Column: 5
"""Returns true, if **path** is located under the **base** directory."""
if not path or not base: # empty path may happen, base too
return False
rp = os.path.relpath(path, base)
return ((not rp.startswith(os.path.pardir)) and (not rp == os.path.curdir))
def _inject_venv_variables(env):
if 'ENV' not in env:
Reported by Pylint.
Line: 64
Column: 1
if not path or not base: # empty path may happen, base too
return False
rp = os.path.relpath(path, base)
return ((not rp.startswith(os.path.pardir)) and (not rp == os.path.curdir))
def _inject_venv_variables(env):
if 'ENV' not in env:
env['ENV'] = {}
Reported by Pylint.
Line: 70
Column: 5
def _inject_venv_variables(env):
if 'ENV' not in env:
env['ENV'] = {}
ENV = env['ENV']
for name in virtualenv_variables:
try:
ENV[name] = os.environ[name]
except KeyError:
pass
Reported by Pylint.
Line: 94
Column: 1
return [path for path in path_list if IsInVirtualenv(path)]
def ImportVirtualenv(env):
"""Copies virtualenv-related environment variables from OS environment
to ``env['ENV']`` and prepends virtualenv's PATH to ``env['ENV']['PATH']``.
"""
_inject_venv_variables(env)
_inject_venv_path(env)
Reported by Pylint.
Line: 102
Column: 1
_inject_venv_path(env)
def Virtualenv():
"""Returns path to the virtualenv home if scons is executing within a
virtualenv or None, if not."""
if _running_in_virtualenv():
return sys.prefix
return None
Reported by Pylint.
Line: 110
Column: 1
return None
def IsInVirtualenv(path):
"""Returns True, if **path** is under virtualenv's home directory. If not,
or if we don't use virtualenv, returns False."""
return _is_path_in(path, Virtualenv())
Reported by Pylint.
buildscripts/gdb/mongo_lock.py
8 issues
Line: 6
Column: 1
import re
import sys
import gdb
import gdb.printing
if sys.version_info[0] < 3:
raise gdb.GdbError(
"MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2")
Reported by Pylint.
Line: 7
Column: 1
import sys
import gdb
import gdb.printing
if sys.version_info[0] < 3:
raise gdb.GdbError(
"MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2")
Reported by Pylint.
Line: 14
Column: 1
"MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2")
class NonExecutingThread(object):
"""NonExecutingThread class.
Idle multi-statement transactions can hold locks that are not associated with an active
thread. In order to generate meaningful digraphs that include these locks, we create an
object that implements the "Thread" class interface but populates with LockerId rather than
Reported by Pylint.
Line: 43
Column: 1
return "LockerId {}".format(self.locker_id)
class Thread(object):
"""Thread class."""
def __init__(self, thread_id, lwpid, thread_name):
"""Initialize Thread."""
self.thread_id = thread_id
Reported by Pylint.
Line: 68
Column: 1
return "Thread 0x{:012x}".format(self.thread_id)
class Lock(object):
"""Lock class."""
def __init__(self, addr, resource):
"""Initialize Lock."""
self.addr = addr
Reported by Pylint.
Line: 92
Column: 1
return "Lock 0x{:012x}".format(self.addr)
class Graph(object):
"""Graph class.
The Graph is a dict with the following structure:
{'node_key': {'node': {id: val}, 'next_nodes': [node_key_1, ...]}}
Example graph:
Reported by Pylint.
Line: 177
Column: 9
def to_graph(self, nodes=None, message=None):
"""Return the 'to_graph'."""
sb = []
sb.append('# Legend:')
sb.append('# Thread 1 -> Lock C (MODE_IX) indicates Thread 1 is waiting on Lock C and'
' Lock C is currently held in MODE_IX')
sb.append('# Lock C (MODE_IX) -> Thread 2 indicates Lock C is held by Thread 2 in'
' MODE_IX')
Reported by Pylint.
Line: 439
Column: 47
cycle_message = "# Cycle detected in the graph nodes %s" % cycle_nodes
if graph_file:
print("Saving digraph to %s" % graph_file)
with open(graph_file, 'w') as fh:
fh.write(graph.to_graph(nodes=cycle_nodes, message=cycle_message))
print(cycle_message.split("# ")[1])
else:
print(graph.to_graph(nodes=cycle_nodes, message=cycle_message))
Reported by Pylint.
src/third_party/wiredtiger/lang/python/wiredtiger/init.py
8 issues
Line: 52
Column: 1
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does. It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
value = getattr(swig_wiredtiger, name)
setattr(me, name, value)
Reported by Pylint.
Line: 53
Column: 1
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does. It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
value = getattr(swig_wiredtiger, name)
setattr(me, name, value)
Reported by Pylint.
Line: 52
Column: 1
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does. It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
value = getattr(swig_wiredtiger, name)
setattr(me, name, value)
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: 35
Column: 1
# This is needed because SWIG's import helper code created by certain SWIG
# versions may be broken, see: https://github.com/swig/swig/issues/769 .
# Importing indirectly seems to avoid these issues.
import os, sys
fname = os.path.basename(__file__)
if fname != '__init__.py' and fname != '__init__.pyc':
print(__file__ + ': this file is not yet installed')
sys.exit(1)
Reported by Pylint.
Line: 37
Column: 4
# Importing indirectly seems to avoid these issues.
import os, sys
fname = os.path.basename(__file__)
if fname != '__init__.py' and fname != '__init__.pyc':
print(__file__ + ': this file is not yet installed')
sys.exit(1)
if sys.version_info[0] <= 2:
print('WiredTiger requires Python version 3.0 or above')
Reported by Pylint.
Line: 52
Column: 1
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does. It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
value = getattr(swig_wiredtiger, name)
setattr(me, name, value)
Reported by Pylint.
Line: 53
Column: 1
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does. It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
value = getattr(swig_wiredtiger, name)
setattr(me, name, value)
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/darwin.py
8 issues
Line: 35
Column: 1
__revision__ = "src/engine/SCons/Platform/darwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
from . import posix
import os
def generate(env):
posix.generate(env)
env['SHLIBSUFFIX'] = '.dylib'
Reported by Pylint.
Line: 51
Column: 5
# make sure this works on Macs with Tiger or earlier
try:
dirlist = os.listdir('/etc/paths.d')
except:
dirlist = []
for file in dirlist:
filelist.append('/etc/paths.d/'+file)
Reported by Pylint.
Line: 33
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/darwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
from . import posix
import os
def generate(env):
Reported by Pylint.
Line: 36
Column: 1
__revision__ = "src/engine/SCons/Platform/darwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
from . import posix
import os
def generate(env):
posix.generate(env)
env['SHLIBSUFFIX'] = '.dylib'
# put macports paths at front to override Apple's versions, fink path is after
Reported by Pylint.
Line: 38
Column: 1
from . import posix
import os
def generate(env):
posix.generate(env)
env['SHLIBSUFFIX'] = '.dylib'
# put macports paths at front to override Apple's versions, fink path is after
# For now let people who want Macports or Fink tools specify it!
# env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'
Reported by Pylint.
Line: 44
Column: 1
# put macports paths at front to override Apple's versions, fink path is after
# For now let people who want Macports or Fink tools specify it!
# env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'
# Store extra system paths in env['ENV']['PATHOSX']
filelist = ['/etc/paths',]
# make sure this works on Macs with Tiger or earlier
try:
Reported by Pylint.
Line: 46
Column: 1
# env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'
# Store extra system paths in env['ENV']['PATHOSX']
filelist = ['/etc/paths',]
# make sure this works on Macs with Tiger or earlier
try:
dirlist = os.listdir('/etc/paths.d')
except:
Reported by Pylint.
Line: 59
Column: 37
for file in filelist:
if os.path.isfile(file):
with open(file, 'r') as f:
lines = f.readlines()
for line in lines:
if line:
env.AppendENVPath('PATHOSX', line.strip('\n'))
Reported by Pylint.
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.
src/third_party/boost/boost/multi_index/detail/iter_adaptor.hpp
8 issues
Line: 48
Column: 15
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
}
template<class Class>
static bool equal(const Class& x,const Class& y)
{
return x.equal(y);
}
template<class Class>
Reported by FlawFinder.
Line: 50
Column: 14
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
template<class Class>
static bool equal(const Class& x,const Class& y)
{
return x.equal(y);
}
template<class Class>
static void increment(Class& x)
{
Reported by FlawFinder.
Line: 101
Column: 33
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
friend bool operator==(const Derived& x,const Derived& y)
{
return iter_adaptor_access::equal(x,y);
}
Derived& operator++()
{
iter_adaptor_access::increment(final());
Reported by FlawFinder.
Line: 120
Column: 31
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
const forward_iter_adaptor_base<Derived,Base>& x,
const forward_iter_adaptor_base<Derived,Base>& y)
{
return iter_adaptor_access::equal(
static_cast<const Derived&>(x),static_cast<const Derived&>(y));
}
template<>
struct iter_adaptor_selector<std::forward_iterator_tag>
Reported by FlawFinder.
Line: 153
Column: 33
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
friend bool operator==(const Derived& x,const Derived& y)
{
return iter_adaptor_access::equal(x,y);
}
Derived& operator++()
{
iter_adaptor_access::increment(final());
Reported by FlawFinder.
Line: 178
Column: 31
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
const bidirectional_iter_adaptor_base<Derived,Base>& x,
const bidirectional_iter_adaptor_base<Derived,Base>& y)
{
return iter_adaptor_access::equal(
static_cast<const Derived&>(x),static_cast<const Derived&>(y));
}
template<>
struct iter_adaptor_selector<std::bidirectional_iterator_tag>
Reported by FlawFinder.
Line: 212
Column: 33
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
friend bool operator==(const Derived& x,const Derived& y)
{
return iter_adaptor_access::equal(x,y);
}
friend bool operator<(const Derived& x,const Derived& y)
{
return iter_adaptor_access::distance_to(x,y)>0;
Reported by FlawFinder.
Line: 259
Column: 31
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
const random_access_iter_adaptor_base<Derived,Base>& x,
const random_access_iter_adaptor_base<Derived,Base>& y)
{
return iter_adaptor_access::equal(
static_cast<const Derived&>(x),static_cast<const Derived&>(y));
}
template<class Derived,class Base>
bool operator<(
Reported by FlawFinder.