The following issues were found
src/third_party/wiredtiger/test/suite/test_baseconfig.py
6 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os
import wiredtiger, wttest
# test_baseconfig
# test base configuration file being ignored.
class test_baseconfig(wttest.WiredTigerTestCase):
def test_baseconfig(self):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os
import wiredtiger, wttest
# test_baseconfig
# test base configuration file being ignored.
class test_baseconfig(wttest.WiredTigerTestCase):
def test_baseconfig(self):
Reported by Pylint.
Line: 34
Column: 1
# test_baseconfig
# test base configuration file being ignored.
class test_baseconfig(wttest.WiredTigerTestCase):
def test_baseconfig(self):
# Open up another database and modify the baseconfig
os.mkdir("A")
conn = self.wiredtiger_open("A", 'create')
# Mark the new directory as corrupted
Reported by Pylint.
Line: 34
Column: 1
# test_baseconfig
# test base configuration file being ignored.
class test_baseconfig(wttest.WiredTigerTestCase):
def test_baseconfig(self):
# Open up another database and modify the baseconfig
os.mkdir("A")
conn = self.wiredtiger_open("A", 'create')
# Mark the new directory as corrupted
Reported by Pylint.
Line: 35
Column: 5
# test_baseconfig
# test base configuration file being ignored.
class test_baseconfig(wttest.WiredTigerTestCase):
def test_baseconfig(self):
# Open up another database and modify the baseconfig
os.mkdir("A")
conn = self.wiredtiger_open("A", 'create')
# Mark the new directory as corrupted
self.databaseCorrupted("A")
Reported by Pylint.
src/mongo/db/storage/key_string.cpp
6 issues
Line: 1241
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (invert) {
memcpy_flipBits(base, source, bytes);
} else {
memcpy(base, source, bytes);
}
}
// ----------------------------------------------------------------------
Reported by FlawFinder.
Line: 1364
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
case CType::kOID:
if (inverted) {
char buf[OID::kOIDSize];
memcpy_flipBits(buf, reader->skip(OID::kOIDSize), OID::kOIDSize);
*stream << OID::from(buf);
} else {
*stream << OID::from(reader->skip(OID::kOIDSize));
}
Reported by FlawFinder.
Line: 1461
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
if (inverted) {
std::unique_ptr<char[]> ns(new char[size]);
memcpy_flipBits(ns.get(), reader->skip(size), size);
char oidBytes[OID::kOIDSize];
memcpy_flipBits(oidBytes, reader->skip(OID::kOIDSize), OID::kOIDSize);
OID oid = OID::from(oidBytes);
*stream << BSONDBRef(StringData(ns.get(), size), oid);
} else {
const char* ns = static_cast<const char*>(reader->skip(size));
Reported by FlawFinder.
Line: 2291
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (size > 0)
_isAllZeros = false;
setRawSize(size);
memcpy(getDataBuffer(), reader->skip(size), size);
}
void TypeBits::appendBit(uint8_t oneOrZero) {
dassert(oneOrZero == 0 || oneOrZero == 1);
Reported by FlawFinder.
Line: 259
Column: 76
CWE codes:
120
20
template <typename T>
T readType(BufReader* reader, bool inverted) {
MONGO_STATIC_ASSERT(std::is_integral<T>::value);
T t = ConstDataView(static_cast<const char*>(reader->skip(sizeof(T)))).read<T>();
if (inverted)
return ~t;
return t;
}
Reported by FlawFinder.
Line: 2253
Column: 30
CWE codes:
120
20
// Case 4: > 127 bytes; needs 4 size bytes.
if (firstByte == 0x80) {
// The next 4 bytes represent the size in little endian order.
uint32_t s = reader->read<LittleEndian<uint32_t>>();
keyStringAssert(50910, "Invalid overlong encoding.", s > kMaxBytesForShortEncoding);
return s;
}
// Case 1: all zeros.
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/jit/arm64/vixl/MozBaseAssembler-vixl.h
6 issues
Line: 155
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
if (spew_.isDisabled() || !instr)
return;
char buffer[2048];
DisassembleInstruction(buffer, sizeof(buffer), instr);
spew_.spew("%08" PRIx32 "%s%s", instr->InstructionBits(), InstrIndent, buffer);
}
void spewBranch(const vixl::Instruction* instr, const LabelDoc& target) {
Reported by FlawFinder.
Line: 164
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
if (spew_.isDisabled() || !instr)
return;
char buffer[2048];
DisassembleInstruction(buffer, sizeof(buffer), instr);
char labelBuf[128];
labelBuf[0] = 0;
Reported by FlawFinder.
Line: 167
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
char buffer[2048];
DisassembleInstruction(buffer, sizeof(buffer), instr);
char labelBuf[128];
labelBuf[0] = 0;
bool hasTarget = target.valid;
if (!hasTarget)
snprintf(labelBuf, sizeof(labelBuf), "-> (link-time target)");
Reported by FlawFinder.
Line: 199
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
if (spew_.isDisabled() || !instr)
return;
char buffer[2048];
DisassembleInstruction(buffer, sizeof(buffer), instr);
char litbuf[2048];
spew_.formatLiteral(doc, litbuf, sizeof(litbuf));
Reported by FlawFinder.
Line: 202
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
char buffer[2048];
DisassembleInstruction(buffer, sizeof(buffer), instr);
char litbuf[2048];
spew_.formatLiteral(doc, litbuf, sizeof(litbuf));
// The instruction will have the form /^.*pc\+0/ followed by junk that we
// don't need; try to strip it.
Reported by FlawFinder.
Line: 251
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// Emit the instruction at |at|.
static void Emit(Instruction* at, Instr instruction) {
JS_STATIC_ASSERT(sizeof(instruction) == kInstructionSize);
memcpy(at, &instruction, sizeof(instruction));
}
static void EmitBranch(Instruction* at, Instr instruction) {
// TODO: Assert that the buffer already has the instruction marked as a branch.
Emit(at, instruction);
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/jit/arm/LIR-arm.h
6 issues
Line: 693
Column: 55
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
LWasmAtomicBinopI64(const LAllocation& ptr, const LInt64Allocation& value,
const LDefinition& tmpLow, const LDefinition& tmpHigh,
const wasm::MemoryAccessDesc& access, AtomicOp op)
: LInstructionHelper(classOpcode),
access_(access),
op_(op)
{
setOperand(0, ptr);
Reported by FlawFinder.
Line: 695
Column: 17
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
const LDefinition& tmpLow, const LDefinition& tmpHigh,
const wasm::MemoryAccessDesc& access, AtomicOp op)
: LInstructionHelper(classOpcode),
access_(access),
op_(op)
{
setOperand(0, ptr);
setInt64Operand(1, value);
setTemp(0, tmpLow);
Reported by FlawFinder.
Line: 710
Column: 35
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
const LInt64Allocation value() {
return getInt64Operand(1);
}
const wasm::MemoryAccessDesc& access() {
return access_;
}
AtomicOp operation() const {
return op_;
}
Reported by FlawFinder.
Line: 732
Column: 58
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
LIR_HEADER(WasmAtomicExchangeI64);
LWasmAtomicExchangeI64(const LAllocation& ptr, const LInt64Allocation& value,
const wasm::MemoryAccessDesc& access)
: LInstructionHelper(classOpcode),
access_(access)
{
setOperand(0, ptr);
setInt64Operand(1, value);
Reported by FlawFinder.
Line: 734
Column: 17
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
LWasmAtomicExchangeI64(const LAllocation& ptr, const LInt64Allocation& value,
const wasm::MemoryAccessDesc& access)
: LInstructionHelper(classOpcode),
access_(access)
{
setOperand(0, ptr);
setInt64Operand(1, value);
}
Reported by FlawFinder.
Line: 746
Column: 35
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
const LInt64Allocation value() {
return getInt64Operand(1);
}
const wasm::MemoryAccessDesc& access() {
return access_;
}
};
} // namespace jit
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/jit/MIR.cpp
6 issues
Line: 1122
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
out.printf("null");
break;
case MIRType::Boolean:
out.printf(toBoolean() ? "true" : "false");
break;
case MIRType::Int32:
out.printf("0x%x", toInt32());
break;
case MIRType::Int64:
Reported by FlawFinder.
Line: 1128
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
out.printf("0x%x", toInt32());
break;
case MIRType::Int64:
out.printf("0x%" PRIx64, toInt64());
break;
case MIRType::Double:
out.printf("%.16g", toDouble());
break;
case MIRType::Float32:
Reported by FlawFinder.
Line: 1838
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
MConstantElements::printOpcode(GenericPrinter& out) const
{
PrintOpcodeName(out, op());
out.printf(" 0x%" PRIxPTR, value().asValue());
}
void
MLoadUnboxedScalar::printOpcode(GenericPrinter& out) const
{
Reported by FlawFinder.
Line: 4269
CWE codes:
664
// If the last resume point had the same side-effect stack, then we can
// reuse the current side effect without cloning it. This is a simple
// way to share common context by making a spaghetti stack.
if (++cache->stores_.begin() == stores_.begin()) {
stores_.copy(cache->stores_);
return;
}
}
Reported by Cppcheck.
Line: 84
Column: 18
CWE codes:
126
#undef NAME
};
const char* name = names[unsigned(op)];
size_t len = strlen(name);
for (size_t i = 0; i < len; i++)
out.printf("%c", tolower(name[i]));
}
static MConstant*
Reported by FlawFinder.
Line: 1549
Column: 29
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
MOZ_ASSERT(left->type() == right->type());
MIRType opType = left->type();
MOZ_ASSERT(IsSimdType(opType));
bool IsEquality = op == equal || op == notEqual;
// Check if this is an unsupported unsigned compare that needs to be biased.
// If so, put the bias vector in `bias`.
if (sign == SimdSign::Unsigned && !IsEquality) {
MInstruction* bias = nullptr;
Reported by FlawFinder.
src/third_party/wiredtiger/dist/docs.py
6 issues
Line: 1
Column: 1
# Read and verify the documentation data to make sure path names are valid.
import os, sys
import docs_data
def check_sort(got, msg, keyfunc=None):
if keyfunc:
expect = sorted(got, key=keyfunc)
else:
Reported by Pylint.
Line: 3
Column: 1
# Read and verify the documentation data to make sure path names are valid.
import os, sys
import docs_data
def check_sort(got, msg, keyfunc=None):
if keyfunc:
expect = sorted(got, key=keyfunc)
else:
Reported by Pylint.
Line: 6
Column: 1
import os, sys
import docs_data
def check_sort(got, msg, keyfunc=None):
if keyfunc:
expect = sorted(got, key=keyfunc)
else:
expect = sorted(got)
if got != expect:
Reported by Pylint.
Line: 17
Column: 1
print(' expect: ' + str(expect))
# An include filename will be sorted first.
def inc_first(f):
if '/include/' in f:
return '_' + f
else:
return f
Reported by Pylint.
Line: 17
Column: 1
print(' expect: ' + str(expect))
# An include filename will be sorted first.
def inc_first(f):
if '/include/' in f:
return '_' + f
else:
return f
Reported by Pylint.
Line: 18
Column: 5
# An include filename will be sorted first.
def inc_first(f):
if '/include/' in f:
return '_' + f
else:
return f
top_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/gc/GCTrace.cpp
6 issues
Line: 84
Column: 22
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
/* This currently does not support multiple runtimes. */
MOZ_ALWAYS_TRUE(!gcTraceFile);
char* filename = getenv("JS_GC_TRACE");
if (!filename)
return true;
if (!tracedClasses.init() || !tracedTypes.init()) {
FinishTrace();
Reported by FlawFinder.
Line: 71
Column: 13
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
union
{
uint64_t word;
char chars[charsPerWord];
} data;
strncpy(data.chars, string + (i * charsPerWord), charsPerWord);
WriteWord(data.word);
}
}
Reported by FlawFinder.
Line: 93
Column: 19
CWE codes:
362
return false;
}
gcTraceFile = fopen(filename, "w");
if (!gcTraceFile) {
FinishTrace();
return false;
}
Reported by FlawFinder.
Line: 182
Column: 12
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
js::gc::TraceTypeNewScript(ObjectGroup* group)
{
const size_t bufLength = 128;
static char buffer[bufLength];
MOZ_ASSERT(group->hasNewScript());
JSAtom* funName = group->newScript()->fun->displayAtom();
if (!funName)
return;
Reported by FlawFinder.
Line: 62
Column: 21
CWE codes:
126
{
JS_STATIC_ASSERT(sizeof(char) == 1);
size_t length = strlen(string);
const unsigned charsPerWord = sizeof(uint64_t);
unsigned wordCount = (length + charsPerWord - 1) / charsPerWord;
TraceEvent(TraceDataString, length);
for (unsigned i = 0; i < wordCount; ++i) {
Reported by FlawFinder.
Line: 73
Column: 9
CWE codes:
120
uint64_t word;
char chars[charsPerWord];
} data;
strncpy(data.chars, string + (i * charsPerWord), charsPerWord);
WriteWord(data.word);
}
}
bool
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/devtools/vprof/vprof.cpp
6 issues
Line: 37
Column: 35
CWE codes:
134
Suggestion:
Make format string constant
#endif
#ifndef __STDC_WANT_SECURE_LIB__
#define sprintf_s(b,size,fmt,...) sprintf((b),(fmt),__VA_ARGS__)
#endif
#if THREADED
#define DO_LOCK(lock) Lock(lock); {
#define DO_UNLOCK(lock) }; Unlock(lock)
Reported by FlawFinder.
Line: 70
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
va_start(args, format);
char buf[1024];
vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
printf(buf);
::OutputDebugStringA(buf);
Reported by FlawFinder.
Line: 74
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
va_end(args);
printf(buf);
::OutputDebugStringA(buf);
}
#else
#define vprof_printf printf
#endif
Reported by FlawFinder.
Line: 78
Column: 23
CWE codes:
134
Suggestion:
Use a constant for the format specification
::OutputDebugStringA(buf);
}
#else
#define vprof_printf printf
#endif
static inline entry* reverse (entry* s)
{
entry_t e, n, p;
Reported by FlawFinder.
Line: 69
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
va_list args;
va_start(args, format);
char buf[1024];
vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
printf(buf);
Reported by FlawFinder.
Line: 97
Column: 12
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
static char* f (double d)
{
static char s[80];
char* p;
sprintf_s (s, sizeof(s), "%lf", d);
p = s+VMPI_strlen(s)-1;
while (*p == '0') {
*p = '\0';
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_lsm04.py
6 issues
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import wiredtiger, wttest
# test_lsm_key_format
# LSM doesn't current support column-store keys.
class test_lsm_key_format(wttest.WiredTigerTestCase):
def test_lsm_key_format(self):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import wiredtiger, wttest
# test_lsm_key_format
# LSM doesn't current support column-store keys.
class test_lsm_key_format(wttest.WiredTigerTestCase):
def test_lsm_key_format(self):
Reported by Pylint.
Line: 33
Column: 1
# test_lsm_key_format
# LSM doesn't current support column-store keys.
class test_lsm_key_format(wttest.WiredTigerTestCase):
def test_lsm_key_format(self):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.session.create(
"table:A", "key_format=r,value_format=S,type=lsm"),
'/key_format/')
Reported by Pylint.
Line: 33
Column: 1
# test_lsm_key_format
# LSM doesn't current support column-store keys.
class test_lsm_key_format(wttest.WiredTigerTestCase):
def test_lsm_key_format(self):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.session.create(
"table:A", "key_format=r,value_format=S,type=lsm"),
'/key_format/')
Reported by Pylint.
Line: 34
Column: 5
# test_lsm_key_format
# LSM doesn't current support column-store keys.
class test_lsm_key_format(wttest.WiredTigerTestCase):
def test_lsm_key_format(self):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.session.create(
"table:A", "key_format=r,value_format=S,type=lsm"),
'/key_format/')
Reported by Pylint.
src/third_party/wiredtiger/dist/api_data.py
6 issues
Line: 1
Column: 1
# This file is a python script that describes the WiredTiger API.
class Method:
def __init__(self, config):
# Deal with duplicates: with complex configurations (like
# WT_SESSION::create), it's simpler to deal with duplicates once than
# manually as configurations are defined
self.config = []
lastname = None
Reported by Pylint.
Line: 1
Column: 1
# This file is a python script that describes the WiredTiger API.
class Method:
def __init__(self, config):
# Deal with duplicates: with complex configurations (like
# WT_SESSION::create), it's simpler to deal with duplicates once than
# manually as configurations are defined
self.config = []
lastname = None
Reported by Pylint.
Line: 3
Column: 1
# This file is a python script that describes the WiredTiger API.
class Method:
def __init__(self, config):
# Deal with duplicates: with complex configurations (like
# WT_SESSION::create), it's simpler to deal with duplicates once than
# manually as configurations are defined
self.config = []
lastname = None
Reported by Pylint.
Line: 3
Column: 1
# This file is a python script that describes the WiredTiger API.
class Method:
def __init__(self, config):
# Deal with duplicates: with complex configurations (like
# WT_SESSION::create), it's simpler to deal with duplicates once than
# manually as configurations are defined
self.config = []
lastname = None
Reported by Pylint.
Line: 10
Column: 13
# manually as configurations are defined
self.config = []
lastname = None
for c in sorted(config):
if '.' in c.name:
raise "Bad config key '%s'" % c.name
if c.name == lastname:
continue
lastname = c.name
Reported by Pylint.
Line: 18
Column: 1
lastname = c.name
self.config.append(c)
class Config:
def __init__(self, name, default, desc, subconfig=None, **flags):
self.name = name
self.default = default
self.desc = desc
self.subconfig = subconfig
Reported by Pylint.