The following issues were found
src/third_party/wiredtiger/bench/workgen/runner/many-dhandle-stress.py
67 issues
Line: 36
Column: 1
sys.path.append("/mnt/data0/ravi/work/wiredtiger/bench/workgen/runner")
from runner import *
from wiredtiger import *
from workgen import *
''' The original wtperf input file follows:
# This workload uses several tens of thousands of tables and the workload is evenly distributed
# among them. The workload creates, opens and drop tables, and it generates warning if the time
Reported by Pylint.
Line: 37
Column: 1
from runner import *
from wiredtiger import *
from workgen import *
''' The original wtperf input file follows:
# This workload uses several tens of thousands of tables and the workload is evenly distributed
# among them. The workload creates, opens and drop tables, and it generates warning if the time
# taken is more than the configured max_idle_table_cycle.
Reported by Pylint.
Line: 67
Column: 11
sample_rate=1
'''
context = Context()
conn_config = ""
conn_config += ",cache_size=10G,eviction=(threads_min=4,threads_max=4),file_manager=(close_idle_time=30),session_max=1000,statistics=[all,clear],statistics_log=(wait=1,json=false,on_close=true)" # explicitly added
conn = context.wiredtiger_open("create," + conn_config)
s = conn.open_session("")
Reported by Pylint.
Line: 82
Column: 13
table_count = 15000
for i in range(0, table_count):
tname = "table:test" + str(i)
table = Table(tname)
s.create(tname, wtperf_table_config +\
compress_table_config + table_config)
table.options.key_size = 20
table.options.value_size = 100
table.options.range = 101000
Reported by Pylint.
Line: 93
Column: 11
populate_threads = 1
icount = 15000000
random_range = 1500000000
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_populate_with_range(pop_ops, tables, icount, random_range, populate_threads)
pop_thread = Thread(pop_ops)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
Reported by Pylint.
Line: 93
Column: 21
populate_threads = 1
icount = 15000000
random_range = 1500000000
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_populate_with_range(pop_ops, tables, icount, random_range, populate_threads)
pop_thread = Thread(pop_ops)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
Reported by Pylint.
Line: 95
Column: 14
random_range = 1500000000
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_populate_with_range(pop_ops, tables, icount, random_range, populate_threads)
pop_thread = Thread(pop_ops)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
ops = Operation(Operation.OP_INSERT, tables[0], Key(Key.KEYGEN_PARETO, 0, ParetoOptions(10)))
# Updated the range_partition to False, because workgen has some issues with range_partition true.
Reported by Pylint.
Line: 96
Column: 16
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_populate_with_range(pop_ops, tables, icount, random_range, populate_threads)
pop_thread = Thread(pop_ops)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
ops = Operation(Operation.OP_INSERT, tables[0], Key(Key.KEYGEN_PARETO, 0, ParetoOptions(10)))
# Updated the range_partition to False, because workgen has some issues with range_partition true.
# Revert it back after WT-7332.
Reported by Pylint.
Line: 99
Column: 7
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
ops = Operation(Operation.OP_INSERT, tables[0], Key(Key.KEYGEN_PARETO, 0, ParetoOptions(10)))
# Updated the range_partition to False, because workgen has some issues with range_partition true.
# Revert it back after WT-7332.
ops = op_multi_table(ops, tables, False)
thread0 = Thread(ops)
thread0.options.throttle=1000
Reported by Pylint.
Line: 99
Column: 53
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
ops = Operation(Operation.OP_INSERT, tables[0], Key(Key.KEYGEN_PARETO, 0, ParetoOptions(10)))
# Updated the range_partition to False, because workgen has some issues with range_partition true.
# Revert it back after WT-7332.
ops = op_multi_table(ops, tables, False)
thread0 = Thread(ops)
thread0.options.throttle=1000
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/win32.py
67 issues
Line: 51
Column: 5
]
try:
import msvcrt
import win32api
import win32con
except ImportError:
parallel_msg = \
"you do not seem to have the pywin32 extensions installed;\n" + \
Reported by Pylint.
Line: 52
Column: 5
try:
import msvcrt
import win32api
import win32con
except ImportError:
parallel_msg = \
"you do not seem to have the pywin32 extensions installed;\n" + \
"\tparallel (-j) builds may not work reliably with open Python files."
Reported by Pylint.
Line: 53
Column: 5
try:
import msvcrt
import win32api
import win32con
except ImportError:
parallel_msg = \
"you do not seem to have the pywin32 extensions installed;\n" + \
"\tparallel (-j) builds may not work reliably with open Python files."
except AttributeError:
Reported by Pylint.
Line: 93
Column: 13
return mode
class _scons_file(_builtin_file):
def __init__(self, name, mode=None, *args, **kwargs):
_builtin_file.__init__(self, name, _scons_fixup_mode(mode),
*args, **kwargs)
def _scons_open(name, mode=None, *args, **kwargs):
return _builtin_open(name, _scons_fixup_mode(mode),
Reported by Pylint.
Line: 97
Column: 9
_builtin_file.__init__(self, name, _scons_fixup_mode(mode),
*args, **kwargs)
def _scons_open(name, mode=None, *args, **kwargs):
return _builtin_open(name, _scons_fixup_mode(mode),
*args, **kwargs)
__builtin__.file = _scons_file
__builtin__.open = _scons_open
Reported by Pylint.
Line: 106
Column: 1
if False:
# Now swap out shutil.filecopy and filecopy2 for win32 api native CopyFile
try:
from ctypes import windll
import shutil
Reported by Pylint.
Line: 156
Column: 13
finally:
spawn_lock.release()
if mode == os.P_WAIT:
pid, status = os.waitpid(ret, 0)
ret = status >> 8
return ret
except ImportError:
# Use the unsafe method of spawnve.
# Please, don't try to optimize this try-except block
Reported by Pylint.
Line: 174
Column: 21
# scons.
def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
# There is no direct way to do that in python. What we do
# here should work for most cases:
# In case stdout (stderr) is not redirected to a file,
# we redirect it into a temporary file tmpFileStdout
# (tmpFileStderr) and copy the contents of this file
Reported by Pylint.
Line: 186
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b306-mktemp-q
return 127
else:
# one temporary file for stdout and stderr
tmpFileStdout = os.path.normpath(tempfile.mktemp())
tmpFileStderr = os.path.normpath(tempfile.mktemp())
# check if output is redirected
stdoutRedirected = 0
stderrRedirected = 0
Reported by Bandit.
Line: 187
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b306-mktemp-q
else:
# one temporary file for stdout and stderr
tmpFileStdout = os.path.normpath(tempfile.mktemp())
tmpFileStderr = os.path.normpath(tempfile.mktemp())
# check if output is redirected
stdoutRedirected = 0
stderrRedirected = 0
for arg in args:
Reported by Bandit.
src/third_party/wiredtiger/test/suite/test_tiered06.py
66 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 os, wiredtiger, wttest
FileSystem = wiredtiger.FileSystem # easy access to constants
# test_tiered06.py
# Test the local storage source's file system implementation.
# Note that the APIs we are testing are not meant to be used directly
Reported by Pylint.
Line: 82
Column: 9
f.close()
# Nothing is in the directory list until a flush.
self.assertEquals(fs.fs_directory_list(session, '', ''), [])
# Flushing moves the file into the file system
local.ss_flush(session, fs, 'foobar', 'foobar', None)
local.ss_flush_finish(session, fs, 'foobar', 'foobar', None)
Reported by Pylint.
Line: 89
Column: 9
local.ss_flush_finish(session, fs, 'foobar', 'foobar', None)
# The object exists now.
self.assertEquals(fs.fs_directory_list(session, '', ''), ['foobar'])
self.assertTrue(fs.fs_exist(session, 'foobar'))
fh = fs.fs_open_file(session, 'foobar', FileSystem.open_file_type_data, FileSystem.open_readonly)
inbytes = bytes(1000000) # An empty buffer with a million zero bytes.
fh.fh_read(session, 0, inbytes) # read into the buffer
Reported by Pylint.
Line: 95
Column: 9
fh = fs.fs_open_file(session, 'foobar', FileSystem.open_file_type_data, FileSystem.open_readonly)
inbytes = bytes(1000000) # An empty buffer with a million zero bytes.
fh.fh_read(session, 0, inbytes) # read into the buffer
self.assertEquals(outbytes[0:1000000], inbytes)
self.assertEquals(fs.fs_size(session, 'foobar'), len(outbytes))
self.assertEquals(fh.fh_size(session), len(outbytes))
fh.close(session)
# The fh_lock call doesn't do anything in the local store implementation.
Reported by Pylint.
Line: 96
Column: 9
inbytes = bytes(1000000) # An empty buffer with a million zero bytes.
fh.fh_read(session, 0, inbytes) # read into the buffer
self.assertEquals(outbytes[0:1000000], inbytes)
self.assertEquals(fs.fs_size(session, 'foobar'), len(outbytes))
self.assertEquals(fh.fh_size(session), len(outbytes))
fh.close(session)
# The fh_lock call doesn't do anything in the local store implementation.
fh = fs.fs_open_file(session, 'foobar', FileSystem.open_file_type_data, FileSystem.open_readonly)
Reported by Pylint.
Line: 97
Column: 9
fh.fh_read(session, 0, inbytes) # read into the buffer
self.assertEquals(outbytes[0:1000000], inbytes)
self.assertEquals(fs.fs_size(session, 'foobar'), len(outbytes))
self.assertEquals(fh.fh_size(session), len(outbytes))
fh.close(session)
# The fh_lock call doesn't do anything in the local store implementation.
fh = fs.fs_open_file(session, 'foobar', FileSystem.open_file_type_data, FileSystem.open_readonly)
fh.fh_lock(session, True)
Reported by Pylint.
Line: 110
Column: 9
with self.expectedStderrPattern('foobar: rename of file not supported'):
self.assertRaisesException(wiredtiger.WiredTigerError,
lambda: fs.fs_rename(session, 'foobar', 'barfoo', 0))
self.assertEquals(fs.fs_directory_list(session, '', ''), ['foobar'])
# Files that have been flushed cannot be manipulated through the custom file system.
with self.expectedStderrPattern('foobar: remove of file not supported'):
self.assertRaisesException(wiredtiger.WiredTigerError,
lambda: fs.fs_remove(session, 'foobar', 0))
Reported by Pylint.
Line: 116
Column: 9
with self.expectedStderrPattern('foobar: remove of file not supported'):
self.assertRaisesException(wiredtiger.WiredTigerError,
lambda: fs.fs_remove(session, 'foobar', 0))
self.assertEquals(fs.fs_directory_list(session, '', ''), ['foobar'])
fs.terminate(session)
local.terminate(session)
def test_local_write_read(self):
Reported by Pylint.
Line: 169
Column: 3
# We do this twice, and between iterations, we remove the cached file to make sure
# it is copied back from the bucket directory.
#
# XXX: this uses knowledge of the implementation, but at the current time,
# we don't have a way via the API to "age out" a file from the cache.
for i in range(0, 2):
in_block = bytes(block_size)
fh = fs.fs_open_file(session, 'abc', FileSystem.open_file_type_data, FileSystem.open_readonly)
Reported by Pylint.
Line: 171
Column: 13
#
# XXX: this uses knowledge of the implementation, but at the current time,
# we don't have a way via the API to "age out" a file from the cache.
for i in range(0, 2):
in_block = bytes(block_size)
fh = fs.fs_open_file(session, 'abc', FileSystem.open_file_type_data, FileSystem.open_readonly)
# Do some spot checks, reading non-sequentially
fh.fh_read(session, 500 * block_size, in_block) # divisible by 2, not 3
Reported by Pylint.
src/third_party/libstemmer_c/runtime/utilities.c
66 issues
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
Line: 19
CWE codes:
401
p = (symbol *) (HEAD + (char *) mem);
CAPACITY(p) = CREATE_SIZE;
SET_SIZE(p, CREATE_SIZE);
return p;
}
SNOWBALL_INLINE void lose_s(symbol * p) {
if (p == NULL) return;
free((char *) p - HEAD);
Reported by Cppcheck.
site_scons/site_tools/ninja.py
66 issues
Line: 37
Column: 1
from os.path import join as joinpath
from os.path import splitext
import SCons
from SCons.Action import _string_from_cmd_list, get_default_ENV
from SCons.Util import is_List, flatten_sequence
from SCons.Script import COMMAND_LINE_TARGETS
NINJA_STATE = None
Reported by Pylint.
Line: 38
Column: 1
from os.path import splitext
import SCons
from SCons.Action import _string_from_cmd_list, get_default_ENV
from SCons.Util import is_List, flatten_sequence
from SCons.Script import COMMAND_LINE_TARGETS
NINJA_STATE = None
NINJA_SYNTAX = "NINJA_SYNTAX"
Reported by Pylint.
Line: 39
Column: 1
import SCons
from SCons.Action import _string_from_cmd_list, get_default_ENV
from SCons.Util import is_List, flatten_sequence
from SCons.Script import COMMAND_LINE_TARGETS
NINJA_STATE = None
NINJA_SYNTAX = "NINJA_SYNTAX"
NINJA_RULES = "__NINJA_CUSTOM_RULES"
Reported by Pylint.
Line: 40
Column: 1
import SCons
from SCons.Action import _string_from_cmd_list, get_default_ENV
from SCons.Util import is_List, flatten_sequence
from SCons.Script import COMMAND_LINE_TARGETS
NINJA_STATE = None
NINJA_SYNTAX = "NINJA_SYNTAX"
NINJA_RULES = "__NINJA_CUSTOM_RULES"
NINJA_POOLS = "__NINJA_CUSTOM_POOLS"
Reported by Pylint.
Line: 1368
Column: 5
def __call__(self, target, source, env, for_signature):
return self.cmd
def _print_cmd_str(*_args, **_kwargs):
"""Disable this method"""
pass
def exists(env):
Reported by Pylint.
Line: 1457
Column: 9
# TODO: change LINKCOM and SHLINKCOM to handle embedding manifest exe checks
# without relying on the SCons hacks that SCons uses by default.
if env["PLATFORM"] == "win32":
from SCons.Tool.mslink import compositeLinkAction
if env["LINKCOM"] == compositeLinkAction:
env[
"LINKCOM"
] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET.windows $_LIBDIRFLAGS $_LIBFLAGS $_PDB $SOURCES.windows", "$LINKCOMSTR")}'
Reported by Pylint.
Line: 959
Column: 1
return command_env
def gen_get_response_file_command(env, rule, tool, tool_is_dynamic=False, custom_env={}):
"""Generate a response file command provider for rule name."""
# If win32 using the environment with a response file command will cause
# ninja to fail to create the response file. Additionally since these rules
# generally are not piping through cmd.exe /c any environment variables will
Reported by Pylint.
Line: 994
Column: 13
# Add 1 so we always keep the actual tool inside of cmd
tool_idx = cmd_list.index(tool_command) + 1
except ValueError:
raise Exception(
"Could not find tool {} in {} generated from {}".format(
tool, cmd_list, get_comstr(env, action, targets, sources)
)
)
Reported by Pylint.
Line: 1017
Column: 27
return get_response_file_command
def generate_command(env, node, action, targets, sources, executor=None):
# Actions like CommandAction have a method called process that is
# used by SCons to generate the cmd_line they need to run. So
# check if it's a thing like CommandAction and call it if we can.
if hasattr(action, "process"):
cmd_list, _, _ = action.process(targets, sources, env, executor=executor)
Reported by Pylint.
Line: 1042
Column: 68
return cmd.replace("$", "$$")
def get_generic_shell_command(env, node, action, targets, sources, executor=None):
if env.get('NINJA_TEMPLATE'):
rule = 'TEMPLATE'
else:
rule = 'CMD'
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_assert06.py
65 issues
Line: 34
Column: 1
#
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_assert06(wttest.WiredTigerTestCase, suite_subprocess):
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 59
Column: 9
uri = 'file:' + base
cfg_on = 'write_timestamp_usage=key_consistent,assert=(write_timestamp=on)'
cfg_off = 'write_timestamp_usage=never,assert=(write_timestamp=off)'
msg_ooo='/out of order/'
msg_usage='/used inconsistently/'
key_nots = 'key_nots' if self.usestrings else 5
key_ts1 = 'key_ts1' if self.usestrings else 16
Reported by Pylint.
Line: 121
Column: 9
self.session.commit_transaction()
c.close()
'''
Commented out for now: the system panics if we fail after preparing a transaction.
c = self.session.open_cursor(uri)
self.session.begin_transaction()
c[key_ts1] = 'value4'
Reported by Pylint.
Line: 138
Column: 13
self.session.begin_transaction()
c[key_ts1] = 'value_nots3'
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.session.commit_transaction(), msg_usage)
c.close()
# Detect using a timestamp on the non-timestamp key.
# We must first use a non timestamped operation on the key
# in order to violate the key consistency condition in the
Reported by Pylint.
Line: 151
Column: 9
self.session.commit_transaction()
c.close()
'''
Commented out for now: the system panics if we fail after preparing a transaction.
c = self.session.open_cursor(uri)
self.session.begin_transaction()
c[key_nots] = 'value3'
Reported by Pylint.
Line: 165
Column: 9
'''
c = self.session.open_cursor(uri)
self.assertEquals(c[key_ts1], 'value5')
self.assertEquals(c[key_nots], 'value_nots3')
c.close()
# Test to make sure that key consistency can be turned off
# after turning it on.
Reported by Pylint.
Line: 166
Column: 9
c = self.session.open_cursor(uri)
self.assertEquals(c[key_ts1], 'value5')
self.assertEquals(c[key_nots], 'value_nots3')
c.close()
# Test to make sure that key consistency can be turned off
# after turning it on.
self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(5))
Reported by Pylint.
Line: 192
Column: 9
def test_timestamp_usage(self):
base = 'assert06'
uri = 'file:' + base
msg_ooo='/out of order/'
msg_usage='/used inconsistently/'
key_nots = 'key_nots' if self.usestrings else 5
key_ts1 = 'key_ts1' if self.usestrings else 16
key_ts2 = 'key_ts2' if self.usestrings else 17
Reported by Pylint.
Line: 217
Column: 9
self.session.commit_transaction()
c.close()
'''
Commented out for now: the system panics if we fail after preparing a transaction.
# Modify the data item at timestamp 1. We should detect it is wrong.
c = self.session.open_cursor(uri)
self.session.begin_transaction()
Reported by Pylint.
Line: 254
Column: 9
self.apply_timestamps(15)
self.session.commit_transaction()
'''
Commented out for now: the system panics if we fail after preparing a transaction.
c = self.session.open_cursor(uri)
self.session.begin_transaction()
c[key_ts3] = 'value13'
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/jit/arm/MacroAssembler-arm.cpp
65 issues
Line: 5013
Column: 56
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssembler::wasmLoad(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, AnyRegister output)
{
wasmLoadImpl(access, memoryBase, ptr, ptrScratch, output, Register64::Invalid());
}
Reported by FlawFinder.
Line: 5016
Column: 18
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MacroAssembler::wasmLoad(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, AnyRegister output)
{
wasmLoadImpl(access, memoryBase, ptr, ptrScratch, output, Register64::Invalid());
}
void
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, Register64 output)
Reported by FlawFinder.
Line: 5020
Column: 59
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, Register64 output)
{
MOZ_ASSERT_IF(access.isAtomic(), access.byteSize() <= 4);
wasmLoadImpl(access, memoryBase, ptr, ptrScratch, AnyRegister(), output);
}
Reported by FlawFinder.
Line: 5023
Column: 19
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, Register64 output)
{
MOZ_ASSERT_IF(access.isAtomic(), access.byteSize() <= 4);
wasmLoadImpl(access, memoryBase, ptr, ptrScratch, AnyRegister(), output);
}
void
MacroAssembler::wasmStore(const wasm::MemoryAccessDesc& access, AnyRegister value,
Reported by FlawFinder.
Line: 5023
Column: 38
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MacroAssembler::wasmLoadI64(const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
Register ptrScratch, Register64 output)
{
MOZ_ASSERT_IF(access.isAtomic(), access.byteSize() <= 4);
wasmLoadImpl(access, memoryBase, ptr, ptrScratch, AnyRegister(), output);
}
void
MacroAssembler::wasmStore(const wasm::MemoryAccessDesc& access, AnyRegister value,
Reported by FlawFinder.
Line: 5024
Column: 18
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
Register ptrScratch, Register64 output)
{
MOZ_ASSERT_IF(access.isAtomic(), access.byteSize() <= 4);
wasmLoadImpl(access, memoryBase, ptr, ptrScratch, AnyRegister(), output);
}
void
MacroAssembler::wasmStore(const wasm::MemoryAccessDesc& access, AnyRegister value,
Register memoryBase, Register ptr, Register ptrScratch)
Reported by FlawFinder.
Line: 5028
Column: 57
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssembler::wasmStore(const wasm::MemoryAccessDesc& access, AnyRegister value,
Register memoryBase, Register ptr, Register ptrScratch)
{
wasmStoreImpl(access, value, Register64::Invalid(), memoryBase, ptr, ptrScratch);
}
Reported by FlawFinder.
Line: 5031
Column: 19
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MacroAssembler::wasmStore(const wasm::MemoryAccessDesc& access, AnyRegister value,
Register memoryBase, Register ptr, Register ptrScratch)
{
wasmStoreImpl(access, value, Register64::Invalid(), memoryBase, ptr, ptrScratch);
}
void
MacroAssembler::wasmStoreI64(const wasm::MemoryAccessDesc& access, Register64 value,
Register memoryBase, Register ptr, Register ptrScratch)
Reported by FlawFinder.
Line: 5035
Column: 60
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
void
MacroAssembler::wasmStoreI64(const wasm::MemoryAccessDesc& access, Register64 value,
Register memoryBase, Register ptr, Register ptrScratch)
{
MOZ_ASSERT(!access.isAtomic());
wasmStoreImpl(access, AnyRegister(), value, memoryBase, ptr, ptrScratch);
}
Reported by FlawFinder.
Line: 5038
Column: 17
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MacroAssembler::wasmStoreI64(const wasm::MemoryAccessDesc& access, Register64 value,
Register memoryBase, Register ptr, Register ptrScratch)
{
MOZ_ASSERT(!access.isAtomic());
wasmStoreImpl(access, AnyRegister(), value, memoryBase, ptr, ptrScratch);
}
void
MacroAssembler::wasmUnalignedLoad(const wasm::MemoryAccessDesc& access, Register memoryBase,
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/CacheDir.py
65 issues
Line: 30
Column: 1
CacheDir support
"""
import hashlib
import json
import os
import stat
import sys
import uuid
Reported by Pylint.
Line: 49
Column: 31
cache_readonly = False
cache_tmp_uuid = uuid.uuid4().hex
def CacheRetrieveFunc(target, source, env):
t = target[0]
fs = t.fs
cd = env.get_CacheDir()
cd.requests += 1
cachedir, cachefile = cd.cachepath(t)
Reported by Pylint.
Line: 54
Column: 5
fs = t.fs
cd = env.get_CacheDir()
cd.requests += 1
cachedir, cachefile = cd.cachepath(t)
if not fs.exists(cachefile):
cd.CacheDebug('CacheRetrieve(%s): %s not in cache\n', t, cachefile)
return 1
cd.hits += 1
cd.CacheDebug('CacheRetrieve(%s): retrieving from %s\n', t, cachefile)
Reported by Pylint.
Line: 73
Column: 33
fs.chmod(t.get_internal_path(), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
return 0
def CacheRetrieveString(target, source, env):
t = target[0]
fs = t.fs
cd = env.get_CacheDir()
cachedir, cachefile = cd.cachepath(t)
if t.fs.exists(cachefile):
Reported by Pylint.
Line: 75
Column: 5
def CacheRetrieveString(target, source, env):
t = target[0]
fs = t.fs
cd = env.get_CacheDir()
cachedir, cachefile = cd.cachepath(t)
if t.fs.exists(cachefile):
return "Retrieved `%s' from cache" % t.get_internal_path()
return None
Reported by Pylint.
Line: 77
Column: 5
t = target[0]
fs = t.fs
cd = env.get_CacheDir()
cachedir, cachefile = cd.cachepath(t)
if t.fs.exists(cachefile):
return "Retrieved `%s' from cache" % t.get_internal_path()
return None
CacheRetrieve = SCons.Action.Action(CacheRetrieveFunc, CacheRetrieveString)
Reported by Pylint.
Line: 86
Column: 27
CacheRetrieveSilent = SCons.Action.Action(CacheRetrieveFunc, None)
def CachePushFunc(target, source, env):
if cache_readonly:
return
t = target[0]
if t.nocache:
Reported by Pylint.
Line: 120
Column: 17
# has beaten us creating the directory.
if not fs.isdir(cachedir):
msg = errfmt % (str(target), cachefile)
raise SCons.Errors.SConsEnvironmentError(msg)
try:
if fs.islink(t.get_internal_path()):
fs.symlink(fs.readlink(t.get_internal_path()), tempfile)
else:
Reported by Pylint.
Line: 189
Column: 13
pass
except OSError:
msg = "Failed to create cache directory " + path
raise SCons.Errors.SConsEnvironmentError(msg)
try:
with open(config_file, 'x') as config:
self.config['prefix_len'] = 2
try:
Reported by Pylint.
Line: 198
Column: 21
json.dump(self.config, config)
except Exception:
msg = "Failed to write cache configuration for " + path
raise SCons.Errors.SConsEnvironmentError(msg)
except FileExistsError:
try:
with open(config_file) as config:
self.config = json.load(config)
except ValueError:
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_content.py
65 issues
Line: 3
Column: 1
# Copyright (c) 2008-2012 testtools developers. See LICENSE for details.
import json
import os
import tempfile
import unittest
from testtools import TestCase
from testtools.compat import (
Reported by Pylint.
Line: 234
Column: 22
self.assertEqual(expected, actual)
def test___init___sets_content_type(self):
stack_lines, expected = self._get_stack_line_and_expected_output()
content = StackLinesContent(stack_lines)
expected_content_type = ContentType("text", "x-traceback",
{"language": "python", "charset": "utf8"})
self.assertEqual(expected_content_type, content.content_type)
Reported by Pylint.
Line: 254
Column: 20
{"language": "python", "charset": "utf8"})
self.assertEqual(content_type, content.content_type)
result = unittest.TestResult()
expected = result._exc_info_to_string(an_exc_info, self)
self.assertEqual(expected, ''.join(list(content.iter_text())))
class TestStacktraceContent(TestCase):
Reported by Pylint.
Line: 1
Column: 1
# Copyright (c) 2008-2012 testtools developers. See LICENSE for details.
import json
import os
import tempfile
import unittest
from testtools import TestCase
from testtools.compat import (
Reported by Pylint.
Line: 43
Column: 1
raises_value_error = Raises(MatchesException(ValueError))
class TestContent(TestCase):
def test___init___None_errors(self):
self.assertThat(lambda: Content(None, None), raises_value_error)
self.assertThat(
lambda: Content(None, lambda: ["traceback"]), raises_value_error)
Reported by Pylint.
Line: 43
Column: 1
raises_value_error = Raises(MatchesException(ValueError))
class TestContent(TestCase):
def test___init___None_errors(self):
self.assertThat(lambda: Content(None, None), raises_value_error)
self.assertThat(
lambda: Content(None, lambda: ["traceback"]), raises_value_error)
Reported by Pylint.
Line: 45
Column: 5
class TestContent(TestCase):
def test___init___None_errors(self):
self.assertThat(lambda: Content(None, None), raises_value_error)
self.assertThat(
lambda: Content(None, lambda: ["traceback"]), raises_value_error)
self.assertThat(
lambda: Content(ContentType("text", "traceback"), None),
Reported by Pylint.
Line: 45
Column: 5
class TestContent(TestCase):
def test___init___None_errors(self):
self.assertThat(lambda: Content(None, None), raises_value_error)
self.assertThat(
lambda: Content(None, lambda: ["traceback"]), raises_value_error)
self.assertThat(
lambda: Content(ContentType("text", "traceback"), None),
Reported by Pylint.
Line: 53
Column: 5
lambda: Content(ContentType("text", "traceback"), None),
raises_value_error)
def test___init___sets_ivars(self):
content_type = ContentType("foo", "bar")
content = Content(content_type, lambda: ["bytes"])
self.assertEqual(content_type, content.content_type)
self.assertEqual(["bytes"], list(content.iter_bytes()))
Reported by Pylint.
Line: 59
Column: 5
self.assertEqual(content_type, content.content_type)
self.assertEqual(["bytes"], list(content.iter_bytes()))
def test___eq__(self):
content_type = ContentType("foo", "bar")
one_chunk = lambda: [_b("bytes")]
two_chunk = lambda: [_b("by"), _b("tes")]
content1 = Content(content_type, one_chunk)
content2 = Content(content_type, one_chunk)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/wtdataset.py
65 issues
Line: 55
Column: 30
def fill(self):
c = self.testcase.session.open_cursor(self.uri, None)
for i in range(1, self.rows + 1):
c[self.key(i)] = self.value(i)
c.close()
def postfill(self):
pass
Reported by Pylint.
Line: 113
Column: 9
self.testcase.pr('check: ' + self.uri)
cursor = self.testcase.session.open_cursor(
self.uri + self.projection, None, None)
self.check_cursor(cursor)
cursor.close()
class SimpleDataSet(BaseDataSet):
"""
SimpleDataSet creates a table with a single key and value that is
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 sys
class BaseDataSet(object):
"""
BaseDataSet is an abstract base class for other *DataSet classes.
An object of this type should not be created directly. These classes
Reported by Pylint.
Line: 123
Column: 5
key_format and value_format may be set in the constructor to
override the simple string defaults.
"""
def __init__(self, testcase, uri, rows, **kwargs):
super(SimpleDataSet, self).__init__(testcase, uri, rows, **kwargs)
# A value suitable for checking the value returned by a cursor.
def comparable_value(self, i):
return BaseDataSet.value_by_format(i, self.value_format)
Reported by Pylint.
Line: 387
Column: 26
def index_count(self):
return 1
def index_name(self, i):
return self.indexname
# create a key based on a cursor as a shortcut to creating a SimpleDataSet
def simple_key(cursor, i):
return BaseDataSet.key_by_format(i, cursor.key_format)
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: 31
Column: 1
#
import sys
class BaseDataSet(object):
"""
BaseDataSet is an abstract base class for other *DataSet classes.
An object of this type should not be created directly. These classes
represent test data sets that can be used to populate tables and
to check the contents of existing tables.
Reported by Pylint.
Line: 47
Column: 5
self.config = kwargs.get('config', '')
self.projection = kwargs.get('projection', '')
def create(self):
self.testcase.session.create(self.uri, 'key_format=' + self.key_format
+ ',value_format=' + self.value_format
+ ',' + self.config)
def fill(self):
Reported by Pylint.
Line: 52
Column: 5
+ ',value_format=' + self.value_format
+ ',' + self.config)
def fill(self):
c = self.testcase.session.open_cursor(self.uri, None)
for i in range(1, self.rows + 1):
c[self.key(i)] = self.value(i)
c.close()
Reported by Pylint.
Line: 53
Column: 9
+ ',' + self.config)
def fill(self):
c = self.testcase.session.open_cursor(self.uri, None)
for i in range(1, self.rows + 1):
c[self.key(i)] = self.value(i)
c.close()
def postfill(self):
Reported by Pylint.