The following issues were found
src/third_party/wiredtiger/test/suite/test_checkpoint08.py
19 issues
Line: 36
Column: 1
# test_checkpoint08.py
# Test that the btree checkpoint is not skipped if there are obsolete pages.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint08(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 37
Column: 1
# Test that the btree checkpoint is not skipped if there are obsolete pages.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint08(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 36
Column: 1
# test_checkpoint08.py
# Test that the btree checkpoint is not skipped if there are obsolete pages.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint08(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 38
Column: 1
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint08(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 52
Column: 9
return val
def test_checkpoint08(self):
self.uri1 = 'table:ckpt08.1'
self.file1 = 'file:ckpt08.1.wt'
self.uri2 = 'table:ckpt08.2'
self.file2 = 'file:ckpt08.2.wt'
self.hsfile = 'file:WiredTigerHS.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
Reported by Pylint.
Line: 53
Column: 9
def test_checkpoint08(self):
self.uri1 = 'table:ckpt08.1'
self.file1 = 'file:ckpt08.1.wt'
self.uri2 = 'table:ckpt08.2'
self.file2 = 'file:ckpt08.2.wt'
self.hsfile = 'file:WiredTigerHS.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
Reported by Pylint.
Line: 54
Column: 9
def test_checkpoint08(self):
self.uri1 = 'table:ckpt08.1'
self.file1 = 'file:ckpt08.1.wt'
self.uri2 = 'table:ckpt08.2'
self.file2 = 'file:ckpt08.2.wt'
self.hsfile = 'file:WiredTigerHS.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
Reported by Pylint.
Line: 55
Column: 9
self.uri1 = 'table:ckpt08.1'
self.file1 = 'file:ckpt08.1.wt'
self.uri2 = 'table:ckpt08.2'
self.file2 = 'file:ckpt08.2.wt'
self.hsfile = 'file:WiredTigerHS.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
# Pin oldest and stable to timestamp 1.
Reported by Pylint.
Line: 56
Column: 9
self.file1 = 'file:ckpt08.1.wt'
self.uri2 = 'table:ckpt08.2'
self.file2 = 'file:ckpt08.2.wt'
self.hsfile = 'file:WiredTigerHS.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
# Pin oldest and stable to timestamp 1.
self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(1) +
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.
src/third_party/wiredtiger/src/schema/schema_create.c
19 issues
Line: 338
Column: 11
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
WT_TABLE *table;
size_t tlen;
char *cgconf, *origconf;
const char **cfgp, *cfg[4] = {WT_CONFIG_BASE(session, colgroup_meta), config, NULL, NULL};
const char *cgname, *source, *sourceconf, *tablename;
const char *sourcecfg[] = {config, NULL, NULL};
bool exists, tracked;
sourceconf = NULL;
Reported by FlawFinder.
Line: 520
Column: 11
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
size_t tlen;
u_int i, npublic_cols;
char *idxconf, *origconf;
const char *cfg[4] = {WT_CONFIG_BASE(session, index_meta), NULL, NULL, NULL};
const char *source, *sourceconf, *idxname, *tablename;
const char *sourcecfg[] = {config, NULL, NULL};
bool exists, have_extractor;
sourceconf = NULL;
Reported by FlawFinder.
Line: 703
Column: 11
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
size_t len;
int ncolgroups, nkeys;
char *cgcfg, *cgname, *filecfg, *filename, *importcfg, *tablecfg;
const char *cfg[4] = {WT_CONFIG_BASE(session, table_meta), config, NULL, NULL};
const char *tablename;
bool import_repair;
import_repair = false;
Reported by FlawFinder.
Line: 842
Column: 11
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
WT_DECL_RET;
WT_TIERED *tiered;
char *meta_value;
const char *cfg[5] = {WT_CONFIG_BASE(session, tiered_meta), NULL, NULL, NULL, NULL};
const char *metadata;
conn = S2C(session);
metadata = NULL;
tiered = NULL;
Reported by FlawFinder.
Line: 293
Column: 37
CWE codes:
126
size_t len;
const char *prefix, *suffix, *tablename;
tablename = table->iface.name + strlen("table:");
if ((ret = __wt_config_getones(session, config, "type", &cval)) == 0 &&
!WT_STRING_MATCH("file", cval.str, cval.len)) {
prefix = cval.str;
len = cval.len;
suffix = "";
Reported by FlawFinder.
Line: 307
Column: 15
CWE codes:
126
* off using tiered storage for this create. Otherwise the default prefix is tiered.
*/
prefix = "file";
len = strlen(prefix);
suffix = ".wt";
} else {
prefix = "tiered";
len = strlen(prefix);
suffix = "";
Reported by FlawFinder.
Line: 311
Column: 15
CWE codes:
126
suffix = ".wt";
} else {
prefix = "tiered";
len = strlen(prefix);
suffix = "";
}
WT_RET_NOTFOUND_OK(ret);
if (cgname == NULL)
Reported by FlawFinder.
Line: 357
Column: 16
CWE codes:
126
tlen = (size_t)(cgname - tablename);
++cgname;
} else
tlen = strlen(tablename);
if ((ret = __wt_schema_get_table(
session, tablename, tlen, true, WT_DHANDLE_EXCLUSIVE, &table)) != 0)
WT_RET_MSG(session, (ret == WT_NOTFOUND) ? ENOENT : ret,
"Can't create '%s' for non-existent table '%.*s'", name, (int)tlen, tablename);
Reported by FlawFinder.
Line: 445
Column: 37
CWE codes:
126
size_t len;
const char *prefix, *suffix, *tablename;
tablename = table->iface.name + strlen("table:");
if ((ret = __wt_config_getones(session, config, "type", &cval)) == 0 &&
!WT_STRING_MATCH("file", cval.str, cval.len)) {
prefix = cval.str;
len = cval.len;
suffix = "_idx";
Reported by FlawFinder.
Line: 453
Column: 15
CWE codes:
126
suffix = "_idx";
} else {
prefix = "file";
len = strlen(prefix);
suffix = ".wti";
}
WT_RET_NOTFOUND_OK(ret);
WT_RET(
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/jit/x86/Lowering-x86.cpp
19 issues
Line: 295
Column: 14
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MDefinition* memoryBase = ins->memoryBase();
MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);
if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
auto* lir = new(alloc()) LWasmAtomicLoadI64(useRegister(memoryBase),
useRegister(base),
tempFixed(ecx),
tempFixed(ebx));
defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),
Reported by FlawFinder.
Line: 295
Column: 55
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MDefinition* memoryBase = ins->memoryBase();
MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);
if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
auto* lir = new(alloc()) LWasmAtomicLoadI64(useRegister(memoryBase),
useRegister(base),
tempFixed(ecx),
tempFixed(ebx));
defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),
Reported by FlawFinder.
Line: 310
Column: 73
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// pointer to a register only if that can't happen.
LAllocation baseAlloc;
if (!base->isConstant() || !(base->toConstant()->isInt32(0) || ins->access().offset() == 0))
baseAlloc = ins->type() == MIRType::Int64 ? useRegister(base) : useRegisterAtStart(base);
if (ins->type() != MIRType::Int64) {
auto* lir = new(alloc()) LWasmLoad(baseAlloc, useRegisterAtStart(memoryBase));
define(lir, ins);
Reported by FlawFinder.
Line: 325
Column: 36
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
auto* lir = new(alloc()) LWasmLoadI64(baseAlloc, useRegister(memoryBase));
Scalar::Type accessType = ins->access().type();
if (accessType == Scalar::Int8 || accessType == Scalar::Int16 || accessType == Scalar::Int32) {
// We use cdq to sign-extend the result and cdq demands these registers.
defineInt64Fixed(lir, ins, LInt64Allocation(LAllocation(AnyRegister(edx)),
LAllocation(AnyRegister(eax))));
return;
Reported by FlawFinder.
Line: 345
Column: 55
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MDefinition* memoryBase = ins->memoryBase();
MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);
if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
auto* lir = new(alloc()) LWasmAtomicStoreI64(useRegister(memoryBase),
useRegister(base),
useInt64Fixed(ins->value(),
Register64(ecx, ebx)),
tempFixed(edx),
Reported by FlawFinder.
Line: 345
Column: 14
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MDefinition* memoryBase = ins->memoryBase();
MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);
if (ins->access().type() == Scalar::Int64 && ins->access().isAtomic()) {
auto* lir = new(alloc()) LWasmAtomicStoreI64(useRegister(memoryBase),
useRegister(base),
useInt64Fixed(ins->value(),
Register64(ecx, ebx)),
tempFixed(edx),
Reported by FlawFinder.
Line: 361
Column: 73
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// pointer to a register only if that can't happen.
LAllocation baseAlloc;
if (!base->isConstant() || !(base->toConstant()->isInt32(0) || ins->access().offset() == 0))
baseAlloc = useRegisterAtStart(base);
LAllocation valueAlloc;
switch (ins->access().type()) {
case Scalar::Int8: case Scalar::Uint8:
Reported by FlawFinder.
Line: 365
Column: 18
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
baseAlloc = useRegisterAtStart(base);
LAllocation valueAlloc;
switch (ins->access().type()) {
case Scalar::Int8: case Scalar::Uint8:
// See comment for LIRGeneratorX86::useByteOpRegister.
valueAlloc = useFixed(ins->value(), eax);
break;
case Scalar::Int16: case Scalar::Uint16:
Reported by FlawFinder.
Line: 444
Column: 18
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
: LAllocation();
LAsmJSStoreHeap* lir = nullptr;
switch (ins->access().type()) {
case Scalar::Int8: case Scalar::Uint8:
// See comment for LIRGeneratorX86::useByteOpRegister.
lir = new(alloc()) LAsmJSStoreHeap(baseAlloc, useFixed(ins->value(), eax),
limitAlloc, useRegisterAtStart(memoryBase));
break;
Reported by FlawFinder.
Line: 480
Column: 14
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MDefinition* memoryBase = ins->memoryBase();
MOZ_ASSERT(memoryBase->type() == MIRType::Pointer);
if (ins->access().type() == Scalar::Int64) {
auto* lir = new(alloc()) LWasmCompareExchangeI64(useRegister(memoryBase),
useRegister(base),
useInt64Fixed(ins->oldValue(),
Register64(edx, eax)),
useInt64Fixed(ins->newValue(),
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_hs03.py
18 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_hs03.py
Reported by Pylint.
Line: 31
Column: 1
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_hs03.py
# Ensure checkpoints don't read too unnecessary history store entries.
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.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_hs03.py
Reported by Pylint.
Line: 48
Column: 24
]
scenarios = make_scenarios(key_format_values)
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: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_hs03.py
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_hs03.py
Reported by Pylint.
Line: 31
Column: 1
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_hs03.py
# Ensure checkpoints don't read too unnecessary history store entries.
Reported by Pylint.
Line: 37
Column: 1
# test_hs03.py
# Ensure checkpoints don't read too unnecessary history store entries.
class test_hs03(wttest.WiredTigerTestCase):
# Force a small cache.
conn_config = 'cache_size=50MB,statistics=(fast)'
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_salvage.py
18 issues
Line: 31
Column: 1
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_salvage.py
# Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_salvage.a'
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 os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_salvage.py
# Utilities: wt salvage
Reported by Pylint.
Line: 104
Column: 13
def check_empty_table(self, tablename):
cursor = self.session.open_cursor('table:' + tablename, None, None)
for gotkey, gotval in cursor:
self.fail(tablename + ': has unexpected entries')
cursor.close()
def damage(self, tablename):
self.damage_inner(tablename, self.unique.encode())
Reported by Pylint.
Line: 104
Column: 21
def check_empty_table(self, tablename):
cursor = self.session.open_cursor('table:' + tablename, None, None)
for gotkey, gotval in cursor:
self.fail(tablename + ': has unexpected entries')
cursor.close()
def damage(self, tablename):
self.damage_inner(tablename, self.unique.encode())
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 os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_salvage.py
# Utilities: wt salvage
Reported by Pylint.
Line: 31
Column: 1
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_salvage.py
# Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_salvage.a'
Reported by Pylint.
Line: 31
Column: 1
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
# test_salvage.py
# Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_salvage.a'
Reported by Pylint.
Line: 35
Column: 1
# test_salvage.py
# Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_salvage.a'
nentries = 1000
session_params = 'key_format=S,value_format=S'
unique = 'SomeUniqueString'
Reported by Pylint.
Line: 35
Column: 1
# test_salvage.py
# Utilities: wt salvage
class test_salvage(wttest.WiredTigerTestCase, suite_subprocess):
tablename = 'test_salvage.a'
nentries = 1000
session_params = 'key_format=S,value_format=S'
unique = 'SomeUniqueString'
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/jit/mips32/Simulator-mips32.cpp
18 issues
Line: 807
Column: 5
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
char hexbytes[256];
sprintf(hexbytes, "0x%x 0x%x 0x%x 0x%x", bytes[0], bytes[1], bytes[2], bytes[3]);
char llvmcmd[1024];
sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
"llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
"grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);
if (system(llvmcmd))
printf("Cannot disassemble instruction.\n");
}
Reported by FlawFinder.
Line: 810
Column: 9
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
"llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
"grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);
if (system(llvmcmd))
printf("Cannot disassemble instruction.\n");
}
void
MipsDebugger::debug()
Reported by FlawFinder.
Line: 537
Column: 23
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
return nullptr;
}
char* stopAtStr = getenv("MIPS_SIM_STOP_AT");
int64_t stopAt;
if (stopAtStr && sscanf(stopAtStr, "%lld", &stopAt) == 1) {
fprintf(stderr, "\nStopping simulation at icount %lld\n", stopAt);
Simulator::StopSimAt = stopAt;
}
Reported by FlawFinder.
Line: 1408
Column: 9
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
bool
SimulatorProcess::init()
{
if (getenv("MIPS_SIM_ICACHE_CHECKS"))
ICacheCheckingDisableCount = 0;
return icache_.init();
}
Reported by FlawFinder.
Line: 500
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
}
private:
char data_[kPageSize]; // The cached data.
static const int kValidityMapSize = kPageSize >> kLineShift;
char validity_map_[kValidityMapSize]; // One byte per line.
};
// Protects the icache() and redirection() properties of the
Reported by FlawFinder.
Line: 502
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
private:
char data_[kPageSize]; // The cached data.
static const int kValidityMapSize = kPageSize >> kLineShift;
char validity_map_[kValidityMapSize]; // One byte per line.
};
// Protects the icache() and redirection() properties of the
// Simulator.
class AutoLockSimulatorCache : public LockGuard<Mutex>
Reported by FlawFinder.
Line: 755
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
ReadLine(const char* prompt)
{
char* result = nullptr;
char lineBuf[256];
int offset = 0;
bool keepGoing = true;
fprintf(stdout, "%s", prompt);
fflush(stdout);
while (keepGoing) {
Reported by FlawFinder.
Line: 786
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return nullptr;
// Copy the existing input into the new array and set the new
// array as the result.
memcpy(new_result, result, offset * sizeof(char));
js_free(result);
result = new_result;
}
// Copy the newly read line into the result.
memcpy(result + offset, lineBuf, len * sizeof(char));
Reported by FlawFinder.
Line: 791
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
result = new_result;
}
// Copy the newly read line into the result.
memcpy(result + offset, lineBuf, len * sizeof(char));
offset += len;
}
MOZ_ASSERT(result);
result[offset] = '\0';
Reported by FlawFinder.
Line: 804
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
DisassembleInstruction(uint32_t pc)
{
uint8_t* bytes = reinterpret_cast<uint8_t*>(pc);
char hexbytes[256];
sprintf(hexbytes, "0x%x 0x%x 0x%x 0x%x", bytes[0], bytes[1], bytes[2], bytes[3]);
char llvmcmd[1024];
sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
"llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
"grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_bug019.py
18 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
Reported by Pylint.
Line: 31
Column: 1
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
Reported by Pylint.
Line: 32
Column: 1
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled,file_max=100K),statistics=(fast)'
Reported by Pylint.
Line: 88
Column: 13
# Wait for a log file to be pre-allocated. Avoid timing problems, but
# assert a file is created within 90 seconds.
def prepfiles(self):
for i in range(1,90):
f = fnmatch.filter(os.listdir('.'), "*Prep*")
if f:
return
time.sleep(1.0)
self.fail('No pre-allocated files created after 90 seconds')
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 fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
Reported by Pylint.
Line: 31
Column: 1
import fnmatch, os, time
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 36
Column: 1
# test_bug019.py
# Test that pre-allocating log files only pre-allocates a small number.
class test_bug019(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled,file_max=100K),statistics=(fast)'
uri = "table:bug019"
entries = 5000
max_initial_entries = 50000
max_prealloc = 1
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_jsondump01.py
18 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
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 os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
Reported by Pylint.
Line: 115
Column: 9
dumpin.close()
# spot check
configs = tables[uri][0]
data = tables[uri][1]["data"]
d = data[24]
if 'column5' in d:
self.assertEqual(d['column5'], '25: abcde')
else:
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 os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os, json
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleLSMDataSet, SimpleIndexDataSet, \
ComplexDataSet, ComplexLSMDataSet
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
Reported by Pylint.
Line: 40
Column: 1
# A 'fake' cursor based on a set of rows.
# It emulates a WT cursor well enough for the *_check_cursor methods.
# They just need an iterable object.
class FakeCursor:
def __init__(self, uri, keyfmt, valuefmt, rows):
self.uri = uri
self.key_format = keyfmt
self.value_format = valuefmt
self.rows = rows
Reported by Pylint.
Line: 54
Column: 5
def __next__(self):
return self.next()
def next(self):
if self.pos >= len(self.rows):
raise StopIteration
else:
row = self.rows[self.pos]
self.pos += 1
Reported by Pylint.
Line: 55
Column: 9
return self.next()
def next(self):
if self.pos >= len(self.rows):
raise StopIteration
else:
row = self.rows[self.pos]
self.pos += 1
tup = []
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_distutilscmd.py
18 issues
Line: 7
Column: 1
from distutils.dist import Distribution
from extras import try_import
from testtools.compat import (
_b,
_u,
BytesIO,
Reported by Pylint.
Line: 9
Column: 1
from extras import try_import
from testtools.compat import (
_b,
_u,
BytesIO,
)
fixtures = try_import('fixtures')
Reported by Pylint.
Line: 64
Column: 9
dist.cmdclass = {'test': TestCommand}
dist.command_options = {
'test': {'test_module': ('command line', 'testtools.runexample')}}
cmd = dist.reinitialize_command('test')
with fixtures.MonkeyPatch('sys.stdout', stdout.stream):
dist.run_command('test')
self.assertThat(
stdout.getDetails()['stdout'].as_text(),
MatchesRegex(_u("""Tests running...
Reported by Pylint.
Line: 86
Column: 9
'test': {
'test_suite': (
'command line', 'testtools.runexample.test_suite')}}
cmd = dist.reinitialize_command('test')
with fixtures.MonkeyPatch('sys.stdout', stdout.stream):
dist.run_command('test')
self.assertThat(
stdout.getDetails()['stdout'].as_text(),
MatchesRegex(_u("""Tests running...
Reported by Pylint.
Line: 16
Column: 1
)
fixtures = try_import('fixtures')
import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex
Reported by Pylint.
Line: 17
Column: 1
fixtures = try_import('fixtures')
import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex
if fixtures:
Reported by Pylint.
Line: 18
Column: 1
import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex
if fixtures:
class SampleTestFixture(fixtures.Fixture):
Reported by Pylint.
Line: 19
Column: 1
import testtools
from testtools import TestCase
from testtools.distutilscmd import TestCommand
from testtools.matchers import MatchesRegex
if fixtures:
class SampleTestFixture(fixtures.Fixture):
"""Creates testtools.runexample temporarily."""
Reported by Pylint.
Line: 23
Column: 5
if fixtures:
class SampleTestFixture(fixtures.Fixture):
"""Creates testtools.runexample temporarily."""
def __init__(self):
self.package = fixtures.PythonPackage(
'runexample', [('__init__.py', _b("""
Reported by Pylint.
Line: 41
Column: 9
return TestLoader().loadTestsFromName(__name__)
"""))])
def setUp(self):
super(SampleTestFixture, self).setUp()
self.useFixture(self.package)
testtools.__path__.append(self.package.base)
self.addCleanup(testtools.__path__.remove, self.package.base)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_home.py
18 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os
import wiredtiger, wttest
# test_isnew
# database is-new method
class test_isnew(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import os
import wiredtiger, wttest
# test_isnew
# database is-new method
class test_isnew(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 39
Column: 9
# Test is-new of a connection.
def test_isnew(self):
# We just created a connection, is_new should return True.
self.assertEquals(self.conn.is_new(), True)
# Close and re-open the connection, is_new should return False.
self.conn.close()
self.conn = self.setUpConnectionOpen(".")
self.assertEquals(self.conn.is_new(), False)
Reported by Pylint.
Line: 44
Column: 9
# Close and re-open the connection, is_new should return False.
self.conn.close()
self.conn = self.setUpConnectionOpen(".")
self.assertEquals(self.conn.is_new(), False)
# test_gethome
# database get-home method
class test_gethome(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 52
Column: 9
# Test gethome of a connection, the initially created one is ".".
def test_gethome_default(self):
self.assertEquals(self.conn.get_home(), '.')
# Create a new database directory, open it and check its name.
def test_gethome_new(self):
name = 'new_database'
os.mkdir(name)
Reported by Pylint.
Line: 60
Column: 9
os.mkdir(name)
self.conn.close()
self.conn = self.setUpConnectionOpen(name)
self.assertEquals(self.conn.get_home(), name)
# test_base_config
# test base configuration file config.
class test_base_config(wttest.WiredTigerTestCase):
def test_base_config(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_isnew
# database is-new method
class test_isnew(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 34
Column: 1
# test_isnew
# database is-new method
class test_isnew(wttest.WiredTigerTestCase):
# Test is-new of a connection.
def test_isnew(self):
# We just created a connection, is_new should return True.
self.assertEquals(self.conn.is_new(), True)
Reported by Pylint.
Line: 34
Column: 1
# test_isnew
# database is-new method
class test_isnew(wttest.WiredTigerTestCase):
# Test is-new of a connection.
def test_isnew(self):
# We just created a connection, is_new should return True.
self.assertEquals(self.conn.is_new(), True)
Reported by Pylint.