The following issues were found
site_scons/site_tools/abilink.py
13 issues
Line: 23
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
import SCons
import subprocess
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
Reported by Pylint.
Line: 24
Column: 1
#
import SCons
import subprocess
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
Reported by Pylint.
Line: 26
Column: 3
import SCons
import subprocess
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
Reported by Pylint.
Line: 27
Column: 3
import subprocess
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
def _detect(env):
Reported by Pylint.
Line: 28
Column: 3
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
def _detect(env):
try:
Reported by Pylint.
Line: 29
Column: 3
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
def _detect(env):
try:
abidw = env["ABIDW"]
Reported by Pylint.
Line: 1
Column: 1
# Copyright 2020 MongoDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
Reported by Pylint.
Line: 24
Column: 1
#
import SCons
import subprocess
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
Reported by Pylint.
Line: 24
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#
import SCons
import subprocess
# TODO: Make a SUFF variable for the suffix to write to
# TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work
# TODO: Make a variable for the md5sum utility (allow any hasher)
# TODO: Add an ABILINKCOM variable to the Action, so it can be silenced.
Reported by Bandit.
Line: 49
Column: 13
def new_emitter(target, source, env):
new_targets = []
for t in target:
abidw = str(t) + ".abidw"
abidw = (t.builder.target_factory or env.File)(abidw)
new_targets.append(abidw)
setattr(t.attributes, "abidw", abidw)
targets = target + new_targets
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/rpm.py
13 issues
Line: 73
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html
handle = subprocess.Popen(get_cmd(source, env),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
with handle.stdout:
output = SCons.Util.to_str(handle.stdout.read())
status = handle.wait()
if status:
Reported by Bandit.
Line: 83
Column: 3
errstr=output,
filename=str(target[0]))
else:
# XXX: assume that LC_ALL=C is set while running rpmbuild
output_files = re.compile('Wrote: (.*)').findall(output)
for output, input in zip(output_files, target):
rpm_output = os.path.basename(output)
expected = os.path.basename(input.get_path())
Reported by Pylint.
Line: 86
Column: 21
# XXX: assume that LC_ALL=C is set while running rpmbuild
output_files = re.compile('Wrote: (.*)').findall(output)
for output, input in zip(output_files, target):
rpm_output = os.path.basename(output)
expected = os.path.basename(input.get_path())
assert expected == rpm_output, "got %s but expected %s" % (rpm_output, expected)
shutil.copy(output, input.get_abspath())
Reported by Pylint.
Line: 99
Column: 16
return status
def string_rpm(target, source, env):
try:
return env['RPMCOMSTR']
except KeyError:
return get_cmd(source, env)
Reported by Pylint.
Line: 36
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/rpm.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import os
import re
import shutil
import subprocess
Reported by Pylint.
Line: 41
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import re
import shutil
import subprocess
import SCons.Builder
import SCons.Node.FS
import SCons.Util
import SCons.Action
Reported by Bandit.
Line: 49
Column: 1
import SCons.Action
import SCons.Defaults
def get_cmd(source, env):
tar_file_with_included_specfile = source
if SCons.Util.is_List(source):
tar_file_with_included_specfile = source[0]
return "%s %s %s"%(env['RPM'], env['RPMFLAGS'],
tar_file_with_included_specfile.get_abspath())
Reported by Pylint.
Line: 56
Column: 1
return "%s %s %s"%(env['RPM'], env['RPMFLAGS'],
tar_file_with_included_specfile.get_abspath())
def build_rpm(target, source, env):
# create a temporary rpm build root.
tmpdir = os.path.join(os.path.dirname(target[0].get_abspath()), 'rpmtemp')
if os.path.exists(tmpdir):
shutil.rmtree(tmpdir)
Reported by Pylint.
Line: 63
Column: 9
shutil.rmtree(tmpdir)
# now create the mandatory rpm directory structure.
for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']:
os.makedirs(os.path.join(tmpdir, d))
# set the topdir as an rpmflag.
env.Prepend(RPMFLAGS = '--define \'_topdir %s\'' % tmpdir)
Reported by Pylint.
Line: 78
Column: 5
output = SCons.Util.to_str(handle.stdout.read())
status = handle.wait()
if status:
raise SCons.Errors.BuildError(node=target[0],
errstr=output,
filename=str(target[0]))
else:
# XXX: assume that LC_ALL=C is set while running rpmbuild
Reported by Pylint.
src/third_party/icu4c-57.1/source/common/utext.cpp
13 issues
Line: 38
Column: 24
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
static UBool
utext_access(UText *ut, int64_t index, UBool forward) {
return ut->pFuncs->access(ut, index, forward);
}
U_CAPI UBool U_EXPORT2
Reported by FlawFinder.
Line: 113
Column: 21
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// Access the new position. Assume a forward iteration from here,
// which will also be optimimum for a single random access.
// Reverse iterations may suffer slightly.
ut->pFuncs->access(ut, index, TRUE);
} else if((int32_t)(index - ut->chunkNativeStart) <= ut->nativeIndexingLimit) {
// utf-16 indexing.
ut->chunkOffset=(int32_t)(index-ut->chunkNativeStart);
} else {
ut->chunkOffset=ut->pFuncs->mapNativeIndexToUTF16(ut, index);
Reported by FlawFinder.
Line: 126
Column: 29
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
UChar c= ut->chunkContents[ut->chunkOffset];
if (U16_IS_TRAIL(c)) {
if (ut->chunkOffset==0) {
ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE);
}
if (ut->chunkOffset>0) {
UChar lead = ut->chunkContents[ut->chunkOffset-1];
if (U16_IS_LEAD(lead)) {
ut->chunkOffset--;
Reported by FlawFinder.
Line: 188
Column: 25
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
UChar32 c;
if (ut->chunkOffset==ut->chunkLength) {
// Current position is just off the end of the chunk.
if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) {
// Off the end of the text.
return U_SENTINEL;
}
}
Reported by FlawFinder.
Line: 218
Column: 25
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// the original position before the unpaired lead still needs to be restored.
int64_t nativePosition = ut->chunkNativeLimit;
int32_t originalOffset = ut->chunkOffset;
if (ut->pFuncs->access(ut, nativePosition, TRUE)) {
trail = ut->chunkContents[ut->chunkOffset];
}
UBool r = ut->pFuncs->access(ut, nativePosition, FALSE); // reverse iteration flag loads preceding chunk
U_ASSERT(r==TRUE);
ut->chunkOffset = originalOffset;
Reported by FlawFinder.
Line: 221
Column: 31
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
if (ut->pFuncs->access(ut, nativePosition, TRUE)) {
trail = ut->chunkContents[ut->chunkOffset];
}
UBool r = ut->pFuncs->access(ut, nativePosition, FALSE); // reverse iteration flag loads preceding chunk
U_ASSERT(r==TRUE);
ut->chunkOffset = originalOffset;
if(!r) {
return U_SENTINEL;
}
Reported by FlawFinder.
Line: 269
Column: 25
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
UChar32 c;
if (ut->chunkOffset >= ut->chunkLength) {
if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) {
return U_SENTINEL;
}
}
c = ut->chunkContents[ut->chunkOffset++];
Reported by FlawFinder.
Line: 283
Column: 25
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
if (ut->chunkOffset >= ut->chunkLength) {
if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) {
// c is an unpaired lead surrogate at the end of the text.
// return it as it is.
return c;
}
}
Reported by FlawFinder.
Line: 309
Column: 25
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
UChar32 c;
if (ut->chunkOffset <= 0) {
if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) {
return U_SENTINEL;
}
}
ut->chunkOffset--;
c = ut->chunkContents[ut->chunkOffset];
Reported by FlawFinder.
Line: 323
Column: 25
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
}
if (ut->chunkOffset <= 0) {
if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) {
// c is an unpaired trail surrogate at the start of the text.
// return it as it is.
return c;
}
}
Reported by FlawFinder.
src/third_party/peglib/peglib.h
13 issues
Line: 226
Column: 3
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
inline std::string encode_codepoint(char32_t cp) {
char buff[4];
auto l = encode_codepoint(cp, buff);
return std::string(buff, l);
}
inline bool decode_codepoint(const char *s8, size_t l, size_t &bytes,
Reported by FlawFinder.
Line: 2220
Column: 14
CWE codes:
126
}
Result parse(const char *s, const char *path = nullptr) const {
auto n = strlen(s);
return parse(s, n, path);
}
Result parse(const char *s, size_t n, any &dt,
const char *path = nullptr) const {
Reported by FlawFinder.
Line: 2231
Column: 14
CWE codes:
126
}
Result parse(const char *s, any &dt, const char *path = nullptr) const {
auto n = strlen(s);
return parse(s, n, dt, path);
}
template <typename T>
Result parse_and_get_value(const char *s, size_t n, T &val,
Reported by FlawFinder.
Line: 2250
Column: 14
CWE codes:
126
template <typename T>
Result parse_and_get_value(const char *s, T &val,
const char *path = nullptr) const {
auto n = strlen(s);
return parse_and_get_value(s, n, val, path);
}
template <typename T>
Result parse_and_get_value(const char *s, size_t n, any &dt, T &val,
Reported by FlawFinder.
Line: 2268
Column: 14
CWE codes:
126
template <typename T>
Result parse_and_get_value(const char *s, any &dt, T &val,
const char *path = nullptr) const {
auto n = strlen(s);
return parse_and_get_value(s, n, dt, val, path);
}
Action operator=(Action a) {
action = a;
Reported by FlawFinder.
Line: 3841
Column: 57
CWE codes:
126
load_grammar(s, n, rules);
}
parser(const char *s, const Rules &rules) : parser(s, strlen(s), rules) {}
parser(const char *s, size_t n) : parser(s, n, Rules()) {}
parser(const char *s) : parser(s, strlen(s), Rules()) {}
Reported by FlawFinder.
Line: 3845
Column: 37
CWE codes:
126
parser(const char *s, size_t n) : parser(s, n, Rules()) {}
parser(const char *s) : parser(s, strlen(s), Rules()) {}
operator bool() { return grammar_ != nullptr; }
bool load_grammar(const char *s, size_t n, const Rules &rules) {
grammar_ = ParserGenerator::parse(s, n, rules, start_, log);
Reported by FlawFinder.
Line: 3859
Column: 14
CWE codes:
126
}
bool load_grammar(const char *s, const Rules &rules) {
auto n = strlen(s);
return load_grammar(s, n, rules);
}
bool load_grammar(const char *s) {
auto n = strlen(s);
Reported by FlawFinder.
Line: 3864
Column: 14
CWE codes:
126
}
bool load_grammar(const char *s) {
auto n = strlen(s);
return load_grammar(s, n);
}
bool parse_n(const char *s, size_t n, const char *path = nullptr) const {
if (grammar_ != nullptr) {
Reported by FlawFinder.
Line: 3879
Column: 14
CWE codes:
126
}
bool parse(const char *s, const char *path = nullptr) const {
auto n = strlen(s);
return parse_n(s, n, path);
}
bool parse_n(const char *s, size_t n, any &dt,
const char *path = nullptr) const {
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_txn23.py
13 issues
Line: 33
Column: 1
# Transactions: ensure read timestamp is not cleared under cache pressure
#
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
class test_txn23(wttest.WiredTigerTestCase):
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 33
Column: 1
# Transactions: ensure read timestamp is not cleared under cache pressure
#
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
class test_txn23(wttest.WiredTigerTestCase):
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
Line: 33
Column: 1
# Transactions: ensure read timestamp is not cleared under cache pressure
#
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
class test_txn23(wttest.WiredTigerTestCase):
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 37
Column: 1
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
class test_txn23(wttest.WiredTigerTestCase):
session_config = 'isolation=snapshot'
conn_config = 'cache_size=5MB'
key_format_values = [
('integer-row', dict(key_format='i')),
Reported by Pylint.
Line: 37
Column: 1
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
class test_txn23(wttest.WiredTigerTestCase):
session_config = 'isolation=snapshot'
conn_config = 'cache_size=5MB'
key_format_values = [
('integer-row', dict(key_format='i')),
Reported by Pylint.
Line: 47
Column: 5
]
scenarios = make_scenarios(key_format_values)
def large_updates(self, uri, value, ds, nrows, commit_ts):
# Update a large number of records.
cursor = self.session.open_cursor(uri)
for i in range(1, nrows + 1):
self.session.begin_transaction()
cursor[ds.key(i)] = value
Reported by Pylint.
Line: 47
Column: 5
]
scenarios = make_scenarios(key_format_values)
def large_updates(self, uri, value, ds, nrows, commit_ts):
# Update a large number of records.
cursor = self.session.open_cursor(uri)
for i in range(1, nrows + 1):
self.session.begin_transaction()
cursor[ds.key(i)] = value
Reported by Pylint.
Line: 47
Column: 5
]
scenarios = make_scenarios(key_format_values)
def large_updates(self, uri, value, ds, nrows, commit_ts):
# Update a large number of records.
cursor = self.session.open_cursor(uri)
for i in range(1, nrows + 1):
self.session.begin_transaction()
cursor[ds.key(i)] = value
Reported by Pylint.
Line: 56
Column: 5
self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(commit_ts))
cursor.close()
def check(self, check_value, uri, ds, nrows, read_ts):
for i in range(1, nrows + 1):
self.session.begin_transaction('read_timestamp=' + self.timestamp_str(read_ts))
cursor = self.session.open_cursor(uri)
self.assertEqual(cursor[ds.key(i)], check_value)
cursor.close()
Reported by Pylint.
src/mongo/db/exec/sbe/values/value.cpp
13 issues
Line: 68
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
auto rawBuffer = buffer.get();
// Copy pattern first and flags after it.
memcpy(rawBuffer, pattern.rawData(), pattern.size());
memcpy(rawBuffer + pattern.size() + 1, flags.rawData(), flags.size());
// Ensure NULL byte is placed after each part.
rawBuffer[pattern.size()] = '\0';
rawBuffer[totalSize - 1] = '\0';
Reported by FlawFinder.
Line: 69
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// Copy pattern first and flags after it.
memcpy(rawBuffer, pattern.rawData(), pattern.size());
memcpy(rawBuffer + pattern.size() + 1, flags.rawData(), flags.size());
// Ensure NULL byte is placed after each part.
rawBuffer[pattern.size()] = '\0';
rawBuffer[totalSize - 1] = '\0';
return {TypeTags::bsonRegex, bitcastFrom<char*>(buffer.release())};
Reported by FlawFinder.
Line: 93
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
ptr += sizeof(uint32_t);
// Write 'ns' followed by a null terminator.
memcpy(ptr, ns.rawData(), nsLen);
ptr[nsLen] = '\0';
ptr += nsLenWithNull;
// Write 'id'.
memcpy(ptr, id, sizeof(ObjectIdType));
Reported by FlawFinder.
Line: 98
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
ptr += nsLenWithNull;
// Write 'id'.
memcpy(ptr, id, sizeof(ObjectIdType));
return {TypeTags::bsonDBPointer, bitcastFrom<char*>(buffer.release())};
}
std::pair<TypeTags, Value> makeNewBsonCodeWScope(StringData code, const char* scope) {
Reported by FlawFinder.
Line: 120
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
ptr += sizeof(uint32_t);
// Write 'code' followed by a null terminator.
memcpy(ptr, code.rawData(), codeLen);
ptr[codeLen] = '\0';
ptr += codeLenWithNull;
// Write 'scope'.
memcpy(ptr, scope, scopeLen);
Reported by FlawFinder.
Line: 125
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
ptr += codeLenWithNull;
// Write 'scope'.
memcpy(ptr, scope, scopeLen);
return {TypeTags::bsonCodeWScope, bitcastFrom<char*>(buffer.release())};
}
std::pair<TypeTags, Value> makeCopyKeyString(const KeyString::Value& inKey) {
Reported by FlawFinder.
Line: 916
Column: 17
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
auto size = getBSONBinDataSize(tag, val);
if (size < 8) {
// Zero initialize buffer and copy bytes in.
char buffer[8] = {};
memcpy(buffer, getRawPointerView(val), size);
// Hash as if it is 64bit integer.
return abslHash(ConstDataView(buffer).read<LittleEndian<uint64_t>>());
} else {
Reported by FlawFinder.
Line: 917
Column: 17
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (size < 8) {
// Zero initialize buffer and copy bytes in.
char buffer[8] = {};
memcpy(buffer, getRawPointerView(val), size);
// Hash as if it is 64bit integer.
return abslHash(ConstDataView(buffer).read<LittleEndian<uint64_t>>());
} else {
// Hash only the first 8 bytes. It should be enough.
Reported by FlawFinder.
Line: 106
Column: 48
CWE codes:
120
20
std::pair<TypeTags, Value> makeNewBsonCodeWScope(StringData code, const char* scope) {
const auto codeLen = code.size();
const auto codeLenWithNull = codeLen + sizeof(char);
const auto scopeLen = ConstDataView(scope).read<LittleEndian<uint32_t>>();
const auto numBytes = 2 * sizeof(uint32_t) + codeLenWithNull + scopeLen;
auto buffer = std::make_unique<char[]>(numBytes);
char* ptr = buffer.get();
// Write length of 'numBytes' as a little-endian uint32_t.
Reported by FlawFinder.
Line: 817
Column: 30
CWE codes:
120
20
inline std::size_t hashObjectId(const uint8_t* objId) noexcept {
auto dataView = ConstDataView(reinterpret_cast<const char*>(objId));
return abslHash(dataView.read<LittleEndian<uint64_t>>()) ^
abslHash(dataView.read<LittleEndian<uint32_t>>(sizeof(uint64_t)));
}
std::size_t hashValue(TypeTags tag, Value val, const CollatorInterface* collator) noexcept {
switch (tag) {
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/wasm/WasmBinaryToText.cpp
13 issues
Line: 71
Column: 33
CWE codes:
126
c.buffer.stringBuffer().clear();
return c.buffer.append("There was a problem when rendering the wasm text format: ") &&
c.buffer.append(msg, strlen(msg)) &&
c.buffer.append("\nYou should consider file a bug on Bugzilla in the "
"Core:::JavaScript Engine::JIT component at "
"https://bugzilla.mozilla.org/enter_bug.cgi.");
}
Reported by FlawFinder.
Line: 559
Column: 35
CWE codes:
126
default: return Fail(c, "unexpected unary operator");
}
return c.buffer.append(opStr, strlen(opStr));
}
static bool
RenderBinaryOperator(WasmRenderContext& c, AstBinaryOperator& binary)
{
Reported by FlawFinder.
Line: 623
Column: 35
CWE codes:
126
default: return Fail(c, "unexpected binary operator");
}
return c.buffer.append(opStr, strlen(opStr));
}
static bool
RenderTernaryOperator(WasmRenderContext& c, AstTernaryOperator& ternary)
{
Reported by FlawFinder.
Line: 646
Column: 35
CWE codes:
126
default: return Fail(c, "unexpected ternary operator");
}
return c.buffer.append(opStr, strlen(opStr));
}
static bool
RenderComparisonOperator(WasmRenderContext& c, AstComparisonOperator& comp)
{
Reported by FlawFinder.
Line: 698
Column: 35
CWE codes:
126
default: return Fail(c, "unexpected comparison operator");
}
return c.buffer.append(opStr, strlen(opStr));
}
static bool
RenderConversionOperator(WasmRenderContext& c, AstConversionOperator& conv)
{
Reported by FlawFinder.
Line: 749
Column: 35
CWE codes:
126
case Op::I64Eqz: opStr = "i64.eqz"; break;
default: return Fail(c, "unexpected conversion operator");
}
return c.buffer.append(opStr, strlen(opStr));
}
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
static bool
RenderExtraConversionOperator(WasmRenderContext& c, AstExtraConversionOperator& conv)
Reported by FlawFinder.
Line: 775
Column: 35
CWE codes:
126
case NumericOp::I64TruncUSatF64: opStr = "i64.trunc_u:sat/f64"; break;
default: return Fail(c, "unexpected extra conversion operator");
}
return c.buffer.append(opStr, strlen(opStr));
}
#endif
static bool
RenderIf(WasmRenderContext& c, AstIf& if_)
Reported by FlawFinder.
Line: 1102
Column: 34
CWE codes:
126
default: return Fail(c, "unexpected cmpxchg operator");
}
if (!c.buffer.append(opname, strlen(opname)))
return false;
return RenderLoadStoreAddress(c, cmpxchg.address(), 0);
}
Reported by FlawFinder.
Line: 1130
Column: 34
CWE codes:
126
default: return Fail(c, "unexpected load operator");
}
if (!c.buffer.append(opname, strlen(opname)))
return false;
return RenderLoadStoreAddress(c, load.address(), 0);
}
Reported by FlawFinder.
Line: 1196
Column: 34
CWE codes:
126
default: return Fail(c, "unexpected rmw operator");
}
if (!c.buffer.append(opname, strlen(opname)))
return false;
return RenderLoadStoreAddress(c, rmw.address(), 0);
}
Reported by FlawFinder.
src/mongo/db/exec/sbe/values/bson.cpp
13 issues
Line: 138
Column: 21
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
value::Value smallString;
// Copy 8 bytes fast if we have space.
if (be + 8 < end) {
memcpy(&smallString, be, 8);
} else {
memcpy(&smallString, be, lenWithNull);
}
return {value::TypeTags::StringSmall, smallString};
} else {
Reported by FlawFinder.
Line: 140
Column: 21
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (be + 8 < end) {
memcpy(&smallString, be, 8);
} else {
memcpy(&smallString, be, lenWithNull);
}
return {value::TypeTags::StringSmall, smallString};
} else {
return value::makeBigString({be, lenWithNull - 1});
}
Reported by FlawFinder.
Line: 166
Column: 17
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (subtype != BinDataType::ByteArrayDeprecated) {
auto metaSize = sizeof(uint32_t) + 1;
auto binData = new uint8_t[size + metaSize];
memcpy(binData, be, size + metaSize);
return {value::TypeTags::bsonBinData, value::bitcastFrom<uint8_t*>(binData)};
} else {
// The legacy byte array stores an extra int32 in byte[size].
auto metaSize = 2 * sizeof(uint32_t) + 1;
auto binData = new uint8_t[size + metaSize];
Reported by FlawFinder.
Line: 172
Column: 17
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// The legacy byte array stores an extra int32 in byte[size].
auto metaSize = 2 * sizeof(uint32_t) + 1;
auto binData = new uint8_t[size + metaSize];
memcpy(binData, be, size + metaSize);
return {value::TypeTags::bsonBinData, value::bitcastFrom<uint8_t*>(binData)};
}
}
case BSONType::Object: {
if constexpr (View) {
Reported by FlawFinder.
Line: 219
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return {value::TypeTags::bsonObjectId, value::bitcastFrom<const char*>(be)};
}
auto [tag, val] = value::makeNewObjectId();
memcpy(value::getObjectIdView(val), be, sizeof(value::ObjectIdType));
return {tag, val};
}
case BSONType::Bool:
return {value::TypeTags::Boolean, value::bitcastFrom<bool>(*(be))};
case BSONType::Date: {
Reported by FlawFinder.
Line: 85
Column: 37
CWE codes:
120
20
} else if (static_cast<BSONType>(type) == BSONType::DBRef) {
be += value::BsonDBPointer(be).byteSize();
} else {
be += ConstDataView(be).read<LittleEndian<uint32_t>>();
if (advOffset == 0xff) {
be += 4;
} else if (advOffset == 0xfe) {
} else {
if (static_cast<BSONType>(type) == BSONType::BinData) {
Reported by FlawFinder.
Line: 117
Column: 44
CWE codes:
120
20
switch (type) {
case BSONType::NumberDouble: {
double dbl = ConstDataView(be).read<LittleEndian<double>>();
return {value::TypeTags::NumberDouble, value::bitcastFrom<double>(dbl)};
}
case BSONType::NumberDecimal: {
if constexpr (View) {
return {value::TypeTags::NumberDecimal, value::bitcastFrom<const char*>(be)};
Reported by FlawFinder.
Line: 132
Column: 59
CWE codes:
120
20
return {value::TypeTags::bsonString, value::bitcastFrom<const char*>(be)};
}
// len includes trailing zero.
auto lenWithNull = uint32_t{ConstDataView(be).read<LittleEndian<uint32_t>>()};
be += sizeof(lenWithNull);
if (value::canUseSmallString({be, lenWithNull - 1})) {
value::Value smallString;
// Copy 8 bytes fast if we have space.
if (be + 8 < end) {
Reported by FlawFinder.
Line: 160
Column: 43
CWE codes:
120
20
return {value::TypeTags::bsonBinData, value::bitcastFrom<const char*>(be)};
}
auto size = ConstDataView(be).read<LittleEndian<uint32_t>>();
auto subtype = static_cast<BinDataType>((be + sizeof(uint32_t))[0]);
if (subtype != BinDataType::ByteArrayDeprecated) {
auto metaSize = sizeof(uint32_t) + 1;
auto binData = new uint8_t[size + metaSize];
Reported by FlawFinder.
Line: 225
Column: 49
CWE codes:
120
20
case BSONType::Bool:
return {value::TypeTags::Boolean, value::bitcastFrom<bool>(*(be))};
case BSONType::Date: {
int64_t integer = ConstDataView(be).read<LittleEndian<int64_t>>();
return {value::TypeTags::Date, value::bitcastFrom<int64_t>(integer)};
}
case BSONType::jstNULL:
return {value::TypeTags::Null, 0};
case BSONType::NumberInt: {
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_checkpoint03.py
13 issues
Line: 38
Column: 1
#
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
Reported by Pylint.
Line: 39
Column: 1
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
conn_config = 'statistics=(all)'
Reported by Pylint.
Line: 38
Column: 1
#
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
Reported by Pylint.
Line: 40
Column: 1
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
conn_config = 'statistics=(all)'
uri = 'table:' + tablename
Reported by Pylint.
Line: 48
Column: 24
uri = 'table:' + tablename
session_config = 'isolation=snapshot, '
def get_stat(self, stat):
stat_cursor = self.session.open_cursor('statistics:')
val = stat_cursor[stat][2]
stat_cursor.close()
return val
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: 38
Column: 1
#
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
Reported by Pylint.
Line: 38
Column: 1
#
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
Reported by Pylint.
Line: 39
Column: 1
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
conn_config = 'statistics=(all)'
Reported by Pylint.
Line: 42
Column: 1
from wiredtiger import stat
from wtscenario import make_scenarios
class test_checkpoint03(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_checkpoint03'
conn_config = 'statistics=(all)'
uri = 'table:' + tablename
session_config = 'isolation=snapshot, '
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/vm/Xdr.h
13 issues
Line: 337
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
uint8_t* ptr = buf.write(len);
if (!ptr)
return fail(JS::TranscodeResult_Throw);
memcpy(ptr, bytes, len);
} else {
const uint8_t* ptr = buf.read(len);
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
memcpy(bytes, ptr, len);
Reported by FlawFinder.
Line: 342
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
const uint8_t* ptr = buf.read(len);
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
memcpy(bytes, ptr, len);
}
return true;
}
/*
Reported by FlawFinder.
Line: 365
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
uint8_t* ptr = buf.write(len);
if (!ptr)
return fail(JS::TranscodeResult_Throw);
memcpy(ptr, *sp, len);
} else {
const uint8_t* ptr = buf.read(len);
if (!ptr || ptr[len] != '\0')
return fail(JS::TranscodeResult_Failure_BadDecode);
*sp = reinterpret_cast<const char*>(ptr);
Reported by FlawFinder.
Line: 85
Column: 20
CWE codes:
120
20
: XDRBufferBase(cx, cursor),
buffer_(buffer.begin(), buffer.length()) { }
const uint8_t* read(size_t n) {
MOZ_ASSERT(cursor_ < buffer_.length());
uint8_t* ptr = &buffer_[cursor_];
cursor_ += n;
// Don't let buggy code read past our buffer
Reported by FlawFinder.
Line: 215
Column: 34
CWE codes:
120
20
}
bool peekData(const uint8_t** pptr, size_t length) {
const uint8_t* ptr = buf.read(length);
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
*pptr = ptr;
return true;
}
Reported by FlawFinder.
Line: 229
Column: 38
CWE codes:
120
20
return fail(JS::TranscodeResult_Throw);
*ptr = *n;
} else {
const uint8_t* ptr = buf.read(sizeof(*n));
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
*n = *ptr;
}
return true;
Reported by FlawFinder.
Line: 244
Column: 38
CWE codes:
120
20
return fail(JS::TranscodeResult_Throw);
mozilla::LittleEndian::writeUint16(ptr, *n);
} else {
const uint8_t* ptr = buf.read(sizeof(*n));
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
*n = mozilla::LittleEndian::readUint16(ptr);
}
return true;
Reported by FlawFinder.
Line: 259
Column: 38
CWE codes:
120
20
return fail(JS::TranscodeResult_Throw);
mozilla::LittleEndian::writeUint32(ptr, *n);
} else {
const uint8_t* ptr = buf.read(sizeof(*n));
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
*n = mozilla::LittleEndian::readUint32(ptr);
}
return true;
Reported by FlawFinder.
Line: 274
Column: 38
CWE codes:
120
20
return fail(JS::TranscodeResult_Throw);
mozilla::LittleEndian::writeUint64(ptr, *n);
} else {
const uint8_t* ptr = buf.read(sizeof(*n));
if (!ptr)
return fail(JS::TranscodeResult_Failure_BadDecode);
*n = mozilla::LittleEndian::readUint64(ptr);
}
return true;
Reported by FlawFinder.