The following issues were found
src/third_party/wiredtiger/src/btree/bt_debug.c
22 issues
Line: 32
Column: 42
CWE codes:
134
Suggestion:
Use a constant for the format specification
WT_ITEM *msg; /* Buffered message */
int (*f)(WT_DBG *, const char *, ...) /* Function to write */
WT_GCC_FUNC_DECL_ATTRIBUTE((format(printf, 2, 3)));
const char *key_format;
const char *value_format;
WT_ITEM *t1, *t2; /* Temporary space */
Reported by FlawFinder.
Line: 227
Column: 11
CWE codes:
134
Suggestion:
Use a constant for the format specification
va_list ap;
va_start(ap, fmt);
ret = vfprintf(ds->fp, fmt, ap) < 0 ? EIO : 0;
va_end(ap);
return (ret);
}
Reported by FlawFinder.
Line: 66
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
int
__wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v)
{
char buf[256];
const char *cfg[2] = {NULL, NULL};
WT_RET(__wt_snprintf(buf, sizeof(buf), "verbose=[%s]", v));
cfg[0] = buf;
return (__wt_verbose_config(session, cfg));
Reported by FlawFinder.
Line: 67
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_debug_set_verbose(WT_SESSION_IMPL *session, const char *v)
{
char buf[256];
const char *cfg[2] = {NULL, NULL};
WT_RET(__wt_snprintf(buf, sizeof(buf), "verbose=[%s]", v));
cfg[0] = buf;
return (__wt_verbose_config(session, cfg));
}
Reported by FlawFinder.
Line: 154
Column: 46
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 the format is 'S', it's a string and our version of it may not yet be nul-terminated.
*/
if (WT_STREQ(ds->value_format, "S") && ((char *)data_arg)[size - 1] != '\0') {
WT_RET(__wt_buf_fmt(session, ds->t2, "%.*s", (int)size, (char *)data_arg));
data_arg = ds->t2->data;
size = ds->t2->size + 1;
}
return (ds->f(ds, "\t%s%s{%s}\n", tag == NULL ? "" : tag, tag == NULL ? "" : " ",
Reported by FlawFinder.
Line: 258
Column: 23
CWE codes:
362
WT_ERR(__wt_scr_alloc(session, 512, &ds->msg));
ds->f = __dmsg_event;
} else {
if ((ds->fp = fopen(ofile, "w")) == NULL)
WT_ERR(__wt_set_return(session, EIO));
__wt_stream_set_line_buffer(ds->fp);
ds->f = __dmsg_file;
}
Reported by FlawFinder.
Line: 421
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
WT_TIME_WINDOW tw;
uint64_t hs_counter, hs_upd_type;
uint32_t hs_btree_id;
char time_string[WT_TIME_STRING_SIZE];
cbt = __wt_curhs_get_cbt(hs_cursor);
session = ds->session;
WT_TIME_WINDOW_INIT(&tw);
Reported by FlawFinder.
Line: 519
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
WT_DECL_ITEM(buf);
WT_DECL_RET;
WT_SESSION_IMPL *session;
char time_string[WT_TIME_STRING_SIZE];
session = ds->session;
WT_RET(ds->f(ds, "\t%s: len %" PRIu32, __wt_cell_type_string(unpack->raw), unpack->size));
Reported by FlawFinder.
Line: 577
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
WT_DBG *ds, WT_PAGE *page, int page_type, const char *tag, WT_CELL_UNPACK_KV *unpack)
{
WT_SESSION_IMPL *session;
char time_string[WT_TIME_STRING_SIZE];
const char *p;
session = ds->session;
/* Column-store references to deleted cells return a NULL cell reference. */
Reported by FlawFinder.
Line: 805
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
{
WT_REF *walk;
WT_SESSION_IMPL *session;
char buf[128];
session = ds->session;
if (F_ISSET(ref, WT_REF_FLAG_INTERNAL)) {
WT_RET(ds->f(ds,
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_checkpoint07.py
21 issues
Line: 32
Column: 1
# test_checkpoint07.py
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint07(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 33
Column: 1
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint07(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 32
Column: 1
# test_checkpoint07.py
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint07(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 34
Column: 1
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint07(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 48
Column: 9
return val
def test_checkpoint07(self):
self.uri1 = 'table:ckpt05.1'
self.file1 = 'file:ckpt05.1.wt'
self.uri2 = 'table:ckpt05.2'
self.file2 = 'file:ckpt05.2.wt'
self.uri3 = 'table:ckpt05.3'
self.file3 = 'file:ckpt05.3.wt'
Reported by Pylint.
Line: 49
Column: 9
def test_checkpoint07(self):
self.uri1 = 'table:ckpt05.1'
self.file1 = 'file:ckpt05.1.wt'
self.uri2 = 'table:ckpt05.2'
self.file2 = 'file:ckpt05.2.wt'
self.uri3 = 'table:ckpt05.3'
self.file3 = 'file:ckpt05.3.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
Reported by Pylint.
Line: 50
Column: 9
def test_checkpoint07(self):
self.uri1 = 'table:ckpt05.1'
self.file1 = 'file:ckpt05.1.wt'
self.uri2 = 'table:ckpt05.2'
self.file2 = 'file:ckpt05.2.wt'
self.uri3 = 'table:ckpt05.3'
self.file3 = 'file:ckpt05.3.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: 51
Column: 9
self.uri1 = 'table:ckpt05.1'
self.file1 = 'file:ckpt05.1.wt'
self.uri2 = 'table:ckpt05.2'
self.file2 = 'file:ckpt05.2.wt'
self.uri3 = 'table:ckpt05.3'
self.file3 = 'file:ckpt05.3.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
self.session.create(self.uri3, 'key_format=i,value_format=i')
Reported by Pylint.
Line: 52
Column: 9
self.file1 = 'file:ckpt05.1.wt'
self.uri2 = 'table:ckpt05.2'
self.file2 = 'file:ckpt05.2.wt'
self.uri3 = 'table:ckpt05.3'
self.file3 = 'file:ckpt05.3.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
self.session.create(self.uri3, 'key_format=i,value_format=i')
Reported by Pylint.
Line: 53
Column: 9
self.uri2 = 'table:ckpt05.2'
self.file2 = 'file:ckpt05.2.wt'
self.uri3 = 'table:ckpt05.3'
self.file3 = 'file:ckpt05.3.wt'
self.session.create(self.uri1, 'key_format=i,value_format=i')
self.session.create(self.uri2, 'key_format=i,value_format=i')
self.session.create(self.uri3, 'key_format=i,value_format=i')
# Setup: Insert some data and checkpoint it. Then modify only
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_rollback_to_stable04.py
21 issues
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from test_rollback_to_stable01 import test_rollback_to_stable_base
def mod_val(value, char, location, nbytes=1):
Reported by Pylint.
Line: 60
Column: 5
scenarios = make_scenarios(key_format_values, in_memory_values, prepare_values)
def conn_config(self):
config = 'cache_size=500MB,statistics=(all)'
if self.in_memory:
config += ',in_memory=true'
else:
config += ',log=(enabled),in_memory=false'
Reported by Pylint.
Line: 162
Column: 5
self.assertGreaterEqual(upd_aborted + hs_removed + hs_sweep, nrows * 11)
if __name__ == '__main__':
wttest.run()
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: 34
Column: 1
from wtscenario import make_scenarios
from test_rollback_to_stable01 import test_rollback_to_stable_base
def mod_val(value, char, location, nbytes=1):
return value[0:location] + char + value[location+nbytes:]
# test_rollback_to_stable04.py
# Test that rollback to stable always replaces the on-disk value with a full update
# from the history store.
Reported by Pylint.
Line: 40
Column: 1
# test_rollback_to_stable04.py
# Test that rollback to stable always replaces the on-disk value with a full update
# from the history store.
class test_rollback_to_stable04(test_rollback_to_stable_base):
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
('integer_row', dict(key_format='i')),
Reported by Pylint.
Line: 40
Column: 1
# test_rollback_to_stable04.py
# Test that rollback to stable always replaces the on-disk value with a full update
# from the history store.
class test_rollback_to_stable04(test_rollback_to_stable_base):
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
('integer_row', dict(key_format='i')),
Reported by Pylint.
Line: 60
Column: 5
scenarios = make_scenarios(key_format_values, in_memory_values, prepare_values)
def conn_config(self):
config = 'cache_size=500MB,statistics=(all)'
if self.in_memory:
config += ',in_memory=true'
else:
config += ',log=(enabled),in_memory=false'
Reported by Pylint.
Line: 68
Column: 5
config += ',log=(enabled),in_memory=false'
return config
def test_rollback_to_stable(self):
nrows = 1000
# Create a table without logging.
uri = "table:rollback_to_stable04"
ds = SimpleDataSet(
Reported by Pylint.
Line: 68
Column: 5
config += ',log=(enabled),in_memory=false'
return config
def test_rollback_to_stable(self):
nrows = 1000
# Create a table without logging.
uri = "table:rollback_to_stable04"
ds = SimpleDataSet(
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/matchers/_filesystem.py
21 issues
Line: 18
Column: 1
import os
import tarfile
from ._basic import Equals
from ._higherorder import (
MatchesAll,
MatchesPredicate,
)
from ._impl import (
Reported by Pylint.
Line: 19
Column: 1
import tarfile
from ._basic import Equals
from ._higherorder import (
MatchesAll,
MatchesPredicate,
)
from ._impl import (
Matcher,
Reported by Pylint.
Line: 23
Column: 1
MatchesAll,
MatchesPredicate,
)
from ._impl import (
Matcher,
)
def PathExists():
Reported by Pylint.
Line: 28
Column: 1
)
def PathExists():
"""Matches if the given path exists.
Use like this::
assertThat('/some/path', PathExists())
Reported by Pylint.
Line: 38
Column: 1
return MatchesPredicate(os.path.exists, "%s does not exist.")
def DirExists():
"""Matches if the path exists and is a directory."""
return MatchesAll(
PathExists(),
MatchesPredicate(os.path.isdir, "%s is not a directory."),
first_only=True)
Reported by Pylint.
Line: 46
Column: 1
first_only=True)
def FileExists():
"""Matches if the given path exists and is a file."""
return MatchesAll(
PathExists(),
MatchesPredicate(os.path.isfile, "%s is not a file."),
first_only=True)
Reported by Pylint.
Line: 54
Column: 1
first_only=True)
class DirContains(Matcher):
"""Matches if the given directory contains files with the given names.
That is, is the directory listing exactly equal to the given files?
"""
Reported by Pylint.
Line: 85
Column: 5
else:
self.matcher = Equals(sorted(filenames))
def match(self, path):
mismatch = DirExists().match(path)
if mismatch is not None:
return mismatch
return self.matcher.match(sorted(os.listdir(path)))
Reported by Pylint.
Line: 119
Column: 5
else:
self.matcher = matcher
def match(self, path):
mismatch = PathExists().match(path)
if mismatch is not None:
return mismatch
f = open(path)
try:
Reported by Pylint.
Line: 123
Column: 9
mismatch = PathExists().match(path)
if mismatch is not None:
return mismatch
f = open(path)
try:
actual_contents = f.read()
return self.matcher.match(actual_contents)
finally:
f.close()
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_inmem01.py
21 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
from time import sleep
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_inmem01.py
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
from time import sleep
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_inmem01.py
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import wiredtiger, wttest
from time import sleep
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_inmem01.py
# Test in-memory configuration.
Reported by Pylint.
Line: 36
Column: 1
# test_inmem01.py
# Test in-memory configuration.
class test_inmem01(wttest.WiredTigerTestCase):
uri = 'table:inmem01'
conn_config = \
'cache_size=5MB,file_manager=(close_idle_time=0),in_memory=true'
table_config = ',memory_page_max=32k,leaf_page_max=4k'
Reported by Pylint.
Line: 36
Column: 1
# test_inmem01.py
# Test in-memory configuration.
class test_inmem01(wttest.WiredTigerTestCase):
uri = 'table:inmem01'
conn_config = \
'cache_size=5MB,file_manager=(close_idle_time=0),in_memory=true'
table_config = ',memory_page_max=32k,leaf_page_max=4k'
Reported by Pylint.
Line: 50
Column: 5
# Smoke-test in-memory configurations, add a small amount of data and
# ensure it's visible.
def test_insert(self):
ds = SimpleDataSet(self, self.uri, 1000, key_format=self.keyfmt,
value_format=self.valuefmt, config=self.table_config)
ds.populate()
ds.check()
Reported by Pylint.
Line: 51
Column: 9
# Smoke-test in-memory configurations, add a small amount of data and
# ensure it's visible.
def test_insert(self):
ds = SimpleDataSet(self, self.uri, 1000, key_format=self.keyfmt,
value_format=self.valuefmt, config=self.table_config)
ds.populate()
ds.check()
# Add more data than fits into the configured cache and verify it fails.
Reported by Pylint.
Line: 57
Column: 5
ds.check()
# Add more data than fits into the configured cache and verify it fails.
def test_insert_over_capacity(self):
msg = '/WT_CACHE_FULL.*/'
ds = SimpleDataSet(self, self.uri, 10000000, key_format=self.keyfmt,
value_format=self.valuefmt, config=self.table_config)
self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
ds.populate, msg)
Reported by Pylint.
Line: 59
Column: 9
# Add more data than fits into the configured cache and verify it fails.
def test_insert_over_capacity(self):
msg = '/WT_CACHE_FULL.*/'
ds = SimpleDataSet(self, self.uri, 10000000, key_format=self.keyfmt,
value_format=self.valuefmt, config=self.table_config)
self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
ds.populate, msg)
# Figure out the last key we successfully inserted, and check all
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_txn22.py
21 issues
Line: 35
Column: 1
import fnmatch, os, shutil, time
from wtscenario import make_scenarios
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
def copy_for_crash_restart(olddir, newdir):
''' Simulate a crash from olddir and restart in newdir. '''
# with the connection still open, copy files to new directory
shutil.rmtree(newdir, ignore_errors=True)
Reported by Pylint.
Line: 32
Column: 1
# test_txn22.py
# Transactions: test salvage with removed
import fnmatch, os, shutil, time
from wtscenario import make_scenarios
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
def copy_for_crash_restart(olddir, newdir):
Reported by Pylint.
Line: 32
Column: 1
# test_txn22.py
# Transactions: test salvage with removed
import fnmatch, os, shutil, time
from wtscenario import make_scenarios
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
def copy_for_crash_restart(olddir, newdir):
Reported by Pylint.
Line: 161
Column: 50
# But the nature of the messages produced during the error is variable
# by which case it is, and even variable from system to system.
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.reopen_conn(salvagedir, self.base_config),
'/.*/')
self.reopen_conn(salvagedir, salvage_config)
if self.filename == 'test_txn22':
self.checks()
Reported by Pylint.
Line: 173
Column: 46
# messages produced during the error is variable by which case
# it is, and even variable from system to system.
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.reopen_conn(salvagedir, salvage_config),
'/.*/')
# The test may output the following error message while opening a file that
# does not exist. Ignore that.
self.ignoreStderrPatternIfExists('No such file or directory')
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: 32
Column: 1
# test_txn22.py
# Transactions: test salvage with removed
import fnmatch, os, shutil, time
from wtscenario import make_scenarios
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
def copy_for_crash_restart(olddir, newdir):
Reported by Pylint.
Line: 35
Column: 1
import fnmatch, os, shutil, time
from wtscenario import make_scenarios
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
def copy_for_crash_restart(olddir, newdir):
''' Simulate a crash from olddir and restart in newdir. '''
# with the connection still open, copy files to new directory
shutil.rmtree(newdir, ignore_errors=True)
Reported by Pylint.
Line: 35
Column: 1
import fnmatch, os, shutil, time
from wtscenario import make_scenarios
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
def copy_for_crash_restart(olddir, newdir):
''' Simulate a crash from olddir and restart in newdir. '''
# with the connection still open, copy files to new directory
shutil.rmtree(newdir, ignore_errors=True)
Reported by Pylint.
Line: 51
Column: 1
"Preplog" not in fullname:
shutil.copy(fullname, newdir)
class test_txn22(wttest.WiredTigerTestCase, suite_subprocess):
base_config = 'cache_size=1GB'
conn_config = base_config
key_format_values = [
('integer-row', dict(key_format='i')),
Reported by Pylint.
src/third_party/boost/boost/math/special_functions/detail/fp_traits.hpp
21 issues
Line: 33
Column: 26
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#include <boost/type_traits/is_floating_point.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{ using ::memcpy; }
#endif
#ifndef FP_NORMAL
#define FP_ZERO 0
Reported by FlawFinder.
Line: 188
Column: 55
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
BOOST_STATIC_CONSTANT(uint32_t, significand = 0x007fffff);
typedef uint32_t bits;
static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); }
static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); }
};
// ieee_tag version, double (64 bits) ----------------------------------------------
Reported by FlawFinder.
Line: 189
Column: 55
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
typedef uint32_t bits;
static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); }
static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); }
};
// ieee_tag version, double (64 bits) ----------------------------------------------
#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) \
Reported by FlawFinder.
Line: 210
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static void get_bits(double x, uint32_t& a)
{
std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
}
static void set_bits(double& x, uint32_t a)
{
std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
Reported by FlawFinder.
Line: 215
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static void set_bits(double& x, uint32_t a)
{
std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
}
private:
#if BOOST_ENDIAN_BIG_BYTE
Reported by FlawFinder.
Line: 244
Column: 56
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
= (((uint64_t)0x000fffff) << 32) + ((uint64_t)0xffffffffu);
typedef uint64_t bits;
static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); }
};
#endif
Reported by FlawFinder.
Line: 245
Column: 56
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
typedef uint64_t bits;
static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); }
};
#endif
#endif // #ifndef BOOST_FPCLASSIFY_VAX_FORMAT
Reported by FlawFinder.
Line: 270
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static void get_bits(long double x, uint32_t& a)
{
std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
}
static void set_bits(long double& x, uint32_t a)
{
std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
Reported by FlawFinder.
Line: 275
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static void set_bits(long double& x, uint32_t a)
{
std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
}
private:
#if BOOST_ENDIAN_BIG_BYTE
Reported by FlawFinder.
Line: 304
Column: 61
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
= ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffffu;
typedef uint64_t bits;
static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
static void set_bits(long double& x, uint64_t a) { std::memcpy(&x, &a, 8); }
};
#endif
Reported by FlawFinder.
src/third_party/pcre-8.42/pcretest.c
21 issues
Line: 3709
Column: 3
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
for callouts. */
*pp++ = 0;
strcpy((char *)pbuffer, (char *)p);
/* Look for modifiers and options after the final delimiter. */
options = default_options;
study_options = force_study_options;
Reported by FlawFinder.
Line: 1895
Column: 7
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
len = strlen(s);
if (len > 0) add_history(s);
if (len > rlen - 1) len = rlen - 1;
memcpy(here, s, len);
here[len] = '\n';
here[len+1] = 0;
free(s);
}
else
Reported by FlawFinder.
Line: 1928
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
exit(1);
}
memcpy(new_buffer, buffer, buffer_size);
memcpy(new_pbuffer, pbuffer, buffer_size);
buffer_size = new_buffer_size;
start = new_buffer + (start - buffer);
Reported by FlawFinder.
Line: 1929
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
memcpy(new_buffer, buffer, buffer_size);
memcpy(new_pbuffer, pbuffer, buffer_size);
buffer_size = new_buffer_size;
start = new_buffer + (start - buffer);
here = new_buffer + (here - buffer);
Reported by FlawFinder.
Line: 1985
Column: 1
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 int pchar(pcre_uint32 c, FILE *f)
{
int n = 0;
char tempbuffer[16];
if (PRINTOK(c))
{
if (f != NULL) fprintf(f, "%c", c);
return 1;
}
Reported by FlawFinder.
Line: 2007
Column: 12
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
}
if (f != NULL) n = fprintf(f, "\\x{%02x}", c);
else n = sprintf(tempbuffer, "\\x{%02x}", c);
return n >= 0 ? n : 0;
}
Reported by FlawFinder.
Line: 3412
Column: 12
CWE codes:
362
if (argc > 1)
{
infile = fopen(argv[op], INPUT_MODE);
if (infile == NULL)
{
printf("** Failed to open %s\n", argv[op]);
yield = 1;
goto EXIT;
Reported by FlawFinder.
Line: 3423
Column: 13
CWE codes:
362
if (argc > 2)
{
outfile = fopen(argv[op+1], OUTPUT_MODE);
if (outfile == NULL)
{
printf("** Failed to open %s\n", argv[op+1]);
yield = 1;
goto EXIT;
Reported by FlawFinder.
Line: 3552
Column: 9
CWE codes:
362
while (isspace(pp[-1])) pp--;
*pp = 0;
f = fopen((char *)p, "rb");
if (f == NULL)
{
fprintf(outfile, "Failed to open %s: %s\n", p, strerror(errno));
continue;
}
Reported by FlawFinder.
Line: 4416
Column: 17
CWE codes:
362
if (to_file != NULL)
{
FILE *f = fopen((char *)to_file, "wb");
if (f == NULL)
{
fprintf(outfile, "Unable to open %s: %s\n", to_file, strerror(errno));
}
else
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_checkpoint04.py
21 issues
Line: 32
Column: 1
# test_checkpoint04.py
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 33
Column: 1
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 32
Column: 1
# test_checkpoint04.py
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 60
Column: 24
session.commit_transaction()
cursor.close()
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: 32
Column: 1
# test_checkpoint04.py
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
Reported by Pylint.
Line: 33
Column: 1
# Test that the checkpoints timing statistics are populated as expected.
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
Reported by Pylint.
Line: 36
Column: 1
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
def create_tables(self, ntables):
tables = {}
Reported by Pylint.
Line: 36
Column: 1
from wiredtiger import stat
from wtdataset import SimpleDataSet
class test_checkpoint04(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
def create_tables(self, ntables):
tables = {}
Reported by Pylint.
Line: 40
Column: 5
conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
session_config = 'isolation=snapshot'
def create_tables(self, ntables):
tables = {}
for i in range(0, ntables):
uri = 'table:table' + str(i)
ds = SimpleDataSet(
self, uri, 0, key_format="i", value_format="S", config='log=(enabled=false)')
Reported by Pylint.
src/third_party/unwind/dist/src/elfxx.c
21 issues
Line: 442
Column: 7
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
else
basedir[0] = 0;
strcpy (newname, basedir);
strcat (newname, "/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
if (ret == -1)
Reported by FlawFinder.
Line: 444
Column: 7
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
strcpy (newname, basedir);
strcat (newname, "/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
if (ret == -1)
{
strcpy (newname, basedir);
Reported by FlawFinder.
Line: 449
Column: 4
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
if (ret == -1)
{
strcpy (newname, basedir);
strcat (newname, "/.debug/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
}
Reported by FlawFinder.
Line: 451
Column: 4
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
{
strcpy (newname, basedir);
strcat (newname, "/.debug/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
}
if (ret == -1 && is_local == 1)
{
Reported by FlawFinder.
Line: 457
Column: 4
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
if (ret == -1 && is_local == 1)
{
strcpy (newname, debugdir);
strcat (newname, basedir);
strcat (newname, "/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
}
Reported by FlawFinder.
Line: 458
Column: 4
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
if (ret == -1 && is_local == 1)
{
strcpy (newname, debugdir);
strcat (newname, basedir);
strcat (newname, "/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
}
Reported by FlawFinder.
Line: 460
Column: 4
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
strcpy (newname, debugdir);
strcat (newname, basedir);
strcat (newname, "/");
strcat (newname, linkbuf);
ret = elf_w (load_debuglink) (newname, ei, -1);
}
if (ret == -1)
{
Reported by FlawFinder.
Line: 316
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
unsigned long segbase, mapoff;
struct elf_image ei;
int ret;
char file[PATH_MAX];
ret = tdep_get_elf_image (&ei, pid, ip, &segbase, &mapoff, file, PATH_MAX);
if (ret < 0)
return ret;
Reported by FlawFinder.
Line: 417
Column: 7
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 linkbuf[shdr->sh_size];
char *link = ((char *) ei->image) + shdr->sh_offset;
char *p;
static const char *debugdir = "/usr/lib/debug";
char basedir[strlen(file) + 1];
char newname[shdr->sh_size + strlen (debugdir) + strlen (file) + 9];
Reported by FlawFinder.
Line: 421
Column: 7
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 *link = ((char *) ei->image) + shdr->sh_offset;
char *p;
static const char *debugdir = "/usr/lib/debug";
char basedir[strlen(file) + 1];
char newname[shdr->sh_size + strlen (debugdir) + strlen (file) + 9];
memcpy(linkbuf, link, shdr->sh_size);
if (memchr (linkbuf, 0, shdr->sh_size) == NULL)
Reported by FlawFinder.