The following issues were found
src/third_party/wiredtiger/test/suite/test_reconfig04.py
7 issues
Line: 33
Column: 1
# session_api:reconfigure
# [END_TAGS]
import wiredtiger, wttest
# test_reconfig04.py
# Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
def test_session_reconfigure(self):
Reported by Pylint.
Line: 33
Column: 1
# session_api:reconfigure
# [END_TAGS]
import wiredtiger, wttest
# test_reconfig04.py
# Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
def test_session_reconfigure(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: 33
Column: 1
# session_api:reconfigure
# [END_TAGS]
import wiredtiger, wttest
# test_reconfig04.py
# Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
def test_session_reconfigure(self):
Reported by Pylint.
Line: 37
Column: 1
# test_reconfig04.py
# Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
def test_session_reconfigure(self):
self.session.reconfigure('ignore_cache_size=false')
self.session.reconfigure('isolation=snapshot')
self.session.reconfigure('isolation=read-committed')
Reported by Pylint.
Line: 37
Column: 1
# test_reconfig04.py
# Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
def test_session_reconfigure(self):
self.session.reconfigure('ignore_cache_size=false')
self.session.reconfigure('isolation=snapshot')
self.session.reconfigure('isolation=read-committed')
Reported by Pylint.
Line: 38
Column: 5
# test_reconfig04.py
# Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
def test_session_reconfigure(self):
self.session.reconfigure('ignore_cache_size=false')
self.session.reconfigure('isolation=snapshot')
self.session.reconfigure('isolation=read-committed')
self.session.reconfigure('isolation=read-uncommitted')
Reported by Pylint.
src/third_party/icu4c-57.1/source/i18n/digitlst.cpp
7 issues
Line: 410
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
// Depends on the C runtime global locale.
// Most commonly is '.'
// TODO: caching could fail if the global locale is changed on the fly.
char rep[MAX_DIGITS];
sprintf(rep, "%+1.1f", 1.0);
result = rep[2];
gDecimal = result;;
}
}
Reported by FlawFinder.
Line: 411
Column: 13
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
// Most commonly is '.'
// TODO: caching could fail if the global locale is changed on the fly.
char rep[MAX_DIGITS];
sprintf(rep, "%+1.1f", 1.0);
result = rep[2];
gDecimal = result;;
}
}
return result;
Reported by FlawFinder.
Line: 446
Column: 9
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
// Depends on the C runtime global locale.
// Most commonly is '.'
// TODO: caching could fail if the global locale is changed on the fly.
char rep[MAX_DIGITS];
sprintf(rep, "%+1.1f", 1.0);
decimalSeparator = rep[2];
}
double tDouble = 0.0;
Reported by FlawFinder.
Line: 447
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
// Most commonly is '.'
// TODO: caching could fail if the global locale is changed on the fly.
char rep[MAX_DIGITS];
sprintf(rep, "%+1.1f", 1.0);
decimalSeparator = rep[2];
}
double tDouble = 0.0;
if (isZero()) {
Reported by FlawFinder.
Line: 719
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
void
DigitList::set(int64_t source)
{
char str[MAX_DIGITS+2]; // Leave room for sign and trailing nul.
formatBase10(source, str);
U_ASSERT(uprv_strlen(str) < sizeof(str));
uprv_decNumberFromString(fDecNumber, str, &fContext);
internalSetDouble(static_cast<double>(source));
Reported by FlawFinder.
Line: 800
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
DigitList::set(double source)
{
// for now, simple implementation; later, do proper IEEE stuff
char rep[MAX_DIGITS + 8]; // Extra space for '+', '.', e+NNN, and '\0' (actually +8 is enough)
// Generate a representation of the form /[+-][0-9].[0-9]+e[+-][0-9]+/
// Can also generate /[+-]nan/ or /[+-]inf/
// TODO: Use something other than sprintf() here, since it's behavior is somewhat platform specific.
// That is why infinity is special cased here.
Reported by FlawFinder.
Line: 813
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
uprv_strcpy(rep,"inf");
}
} else {
sprintf(rep, "%+1.*e", MAX_DBL_DIGITS - 1, source);
}
U_ASSERT(uprv_strlen(rep) < sizeof(rep));
// uprv_decNumberFromString() will parse the string expecting '.' as a
// decimal separator, however sprintf() can use ',' in certain locales.
Reported by FlawFinder.
site_scons/mongo/platform.py
7 issues
Line: 53
Column: 9
"linux": linux_os_list,
}
for os in os_list_to_check:
if os == target_os or (os in os_families and target_os in os_families[os]):
return True
return False
Reported by Pylint.
Line: 19
Column: 1
# It should only be used to set up defaults for options/variables, because
# its value could potentially be overridden by setting TARGET_OS on the
# command-line. Treat this output as the value of HOST_OS
def get_running_os_name():
running_os = os.sys.platform
if running_os.startswith('linux'):
running_os = 'linux'
elif running_os.startswith('freebsd'):
running_os = 'freebsd'
Reported by Pylint.
Line: 38
Column: 1
return running_os
def env_get_os_name_wrapper(self):
return self['TARGET_OS']
def is_os_raw(target_os, os_list_to_check):
darwin_os_list = ['macOS', 'tvOS', 'tvOS-sim', 'iOS', 'iOS-sim', 'watchOS', 'watchOS-sim']
Reported by Pylint.
Line: 42
Column: 1
return self['TARGET_OS']
def is_os_raw(target_os, os_list_to_check):
darwin_os_list = ['macOS', 'tvOS', 'tvOS-sim', 'iOS', 'iOS-sim', 'watchOS', 'watchOS-sim']
linux_os_list = ['android', 'linux']
posix_os_list = ['openbsd', 'freebsd', 'solaris', 'emscripten'] + darwin_os_list + linux_os_list
os_families = {
Reported by Pylint.
Line: 53
Column: 9
"linux": linux_os_list,
}
for os in os_list_to_check:
if os == target_os or (os in os_families and target_os in os_families[os]):
return True
return False
Reported by Pylint.
Line: 63
Column: 1
# It should only be used to set up defaults for options/variables, because
# its value could potentially be overridden by setting TARGET_OS on the
# command-line. Treat this output as the value of HOST_OS
def is_running_os(*os_list):
return is_os_raw(get_running_os_name(), os_list)
def env_os_is_wrapper(self, *os_list):
return is_os_raw(self['TARGET_OS'], os_list)
Reported by Pylint.
Line: 67
Column: 1
return is_os_raw(get_running_os_name(), os_list)
def env_os_is_wrapper(self, *os_list):
return is_os_raw(self['TARGET_OS'], os_list)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_debug_mode05.py
7 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_debug_mode05.py
# As per WT-5046, the debug table logging settings prevent rollback to
# stable in the presence of prepared transactions.
#
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_debug_mode05.py
# As per WT-5046, the debug table logging settings prevent rollback to
# stable in the presence of prepared transactions.
#
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_debug_mode05.py
# As per WT-5046, the debug table logging settings prevent rollback to
# stable in the presence of prepared transactions.
#
Reported by Pylint.
Line: 36
Column: 1
# stable in the presence of prepared transactions.
#
# This test is to confirm the fix and prevent similar regressions.
class test_debug_mode05(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled),debug_mode=(table_logging=true)'
session_config = 'isolation=snapshot'
uri = 'file:test_debug_mode05'
def test_table_logging_rollback_to_stable(self):
Reported by Pylint.
Line: 36
Column: 1
# stable in the presence of prepared transactions.
#
# This test is to confirm the fix and prevent similar regressions.
class test_debug_mode05(wttest.WiredTigerTestCase):
conn_config = 'log=(enabled),debug_mode=(table_logging=true)'
session_config = 'isolation=snapshot'
uri = 'file:test_debug_mode05'
def test_table_logging_rollback_to_stable(self):
Reported by Pylint.
Line: 41
Column: 5
session_config = 'isolation=snapshot'
uri = 'file:test_debug_mode05'
def test_table_logging_rollback_to_stable(self):
self.session.create(self.uri, 'key_format=i,value_format=u,log=(enabled=false)')
self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(100))
self.session.checkpoint()
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_cursor16.py
7 issues
Line: 34
Column: 1
#
import wttest
from wiredtiger import stat
class test_cursor16(wttest.WiredTigerTestCase):
tablename = 'test_cursor16'
uri_prefix = 'table:' + tablename
uri_count = 100
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
#
import wttest
from wiredtiger import stat
class test_cursor16(wttest.WiredTigerTestCase):
tablename = 'test_cursor16'
uri_prefix = 'table:' + tablename
uri_count = 100
Reported by Pylint.
Line: 36
Column: 1
import wttest
from wiredtiger import stat
class test_cursor16(wttest.WiredTigerTestCase):
tablename = 'test_cursor16'
uri_prefix = 'table:' + tablename
uri_count = 100
session_count = 100
Reported by Pylint.
Line: 36
Column: 1
import wttest
from wiredtiger import stat
class test_cursor16(wttest.WiredTigerTestCase):
tablename = 'test_cursor16'
uri_prefix = 'table:' + tablename
uri_count = 100
session_count = 100
Reported by Pylint.
Line: 45
Column: 5
conn_config = 'cache_cursors=true,statistics=(fast),in_memory=true'
# Returns the number of cursors cached
def cached_stats(self):
stat_cursor = self.session.open_cursor('statistics:', None, None)
cache = stat_cursor[stat.conn.cursor_cached_count][2]
stat_cursor.close()
return cache
Reported by Pylint.
Line: 51
Column: 5
stat_cursor.close()
return cache
def test_cursor16(self):
uris = []
cursors = []
#self.tty('begin cursors cached=' + str(self.cached_stats()))
for i in range(0, self.uri_count):
uri = self.uri_prefix + '-' + str(i)
Reported by Pylint.
src/third_party/icu4c-57.1/source/common/cstring.h
7 issues
Line: 34
Column: 57
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
#include <stdlib.h>
#include <ctype.h>
#define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src)
#define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str)
#define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2)
#define uprv_strcat(dst, src) U_STANDARD_CPP_NAMESPACE strcat(dst, src)
#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c)
#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
Reported by FlawFinder.
Line: 37
Column: 56
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
#define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src)
#define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str)
#define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2)
#define uprv_strcat(dst, src) U_STANDARD_CPP_NAMESPACE strcat(dst, src)
#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c)
#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c)
#if U_DEBUG
Reported by FlawFinder.
Line: 35
Column: 51
CWE codes:
126
#include <ctype.h>
#define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src)
#define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str)
#define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2)
#define uprv_strcat(dst, src) U_STANDARD_CPP_NAMESPACE strcat(dst, src)
#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c)
#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c)
Reported by FlawFinder.
Line: 46
Column: 30
CWE codes:
120
#define uprv_strncpy(dst, src, size) ( \
uprv_checkValidMemory(src, 1), \
U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size))
#define uprv_strncmp(s1, s2, n) ( \
uprv_checkValidMemory(s1, 1), \
uprv_checkValidMemory(s2, 1), \
U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n))
#define uprv_strncat(dst, src, n) ( \
Reported by FlawFinder.
Line: 53
Column: 30
CWE codes:
120
Suggestion:
Consider strcat_s, strlcat, snprintf, or automatically resizing strings
U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n))
#define uprv_strncat(dst, src, n) ( \
uprv_checkValidMemory(src, 1), \
U_STANDARD_CPP_NAMESPACE strncat(dst, src, n))
#else
#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n)
Reported by FlawFinder.
Line: 57
Column: 63
CWE codes:
120
#else
#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n)
#define uprv_strncat(dst, src, n) U_STANDARD_CPP_NAMESPACE strncat(dst, src, n)
#endif /* U_DEBUG */
Reported by FlawFinder.
Line: 59
Column: 60
CWE codes:
120
Suggestion:
Consider strcat_s, strlcat, snprintf, or automatically resizing strings
#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n)
#define uprv_strncat(dst, src, n) U_STANDARD_CPP_NAMESPACE strncat(dst, src, n)
#endif /* U_DEBUG */
/**
* Is c an ASCII-repertoire letter a-z or A-Z?
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/sgic++.py
7 issues
Line: 37
Column: 1
__revision__ = "src/engine/SCons/Tool/sgic++.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
#forward proxy to the preffered cxx version
from SCons.Tool.sgicxx import *
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
Reported by Pylint.
Line: 37
Column: 1
__revision__ = "src/engine/SCons/Tool/sgic++.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
#forward proxy to the preffered cxx version
from SCons.Tool.sgicxx import *
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
Reported by Pylint.
Line: 37
Column: 1
__revision__ = "src/engine/SCons/Tool/sgic++.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
#forward proxy to the preffered cxx version
from SCons.Tool.sgicxx import *
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
Reported by Pylint.
Line: 37
Column: 1
__revision__ = "src/engine/SCons/Tool/sgic++.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
#forward proxy to the preffered cxx version
from SCons.Tool.sgicxx import *
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
Reported by Pylint.
Line: 37
Column: 1
__revision__ = "src/engine/SCons/Tool/sgic++.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
#forward proxy to the preffered cxx version
from SCons.Tool.sgicxx import *
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
Reported by Pylint.
Line: 1
Column: 1
"""SCons.Tool.sgic++
Tool-specific initialization for MIPSpro C++ on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
Reported by Pylint.
Line: 34
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/sgic++.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
#forward proxy to the preffered cxx version
from SCons.Tool.sgicxx import *
# Local Variables:
Reported by Pylint.
site_scons/mongo/__init__.py
7 issues
Line: 8
Column: 5
import bisect
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
print("%s failed: %s" % (bf.node, bf.errstr))
def insort_wrapper(target_list, target_string):
"""
Reported by Pylint.
Line: 16
Column: 5
"""
Removes instances of empty list inside the list before handing it to insort.
"""
from SCons.Util import flatten
target_list[:] = flatten(target_list)
bisect.insort(target_list, target_string)
Reported by Pylint.
Line: 1
Column: 1
# -*- mode: python; -*-
# General utility functions live in this file.
import bisect
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
Reported by Pylint.
Line: 7
Column: 1
import bisect
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
print("%s failed: %s" % (bf.node, bf.errstr))
def insort_wrapper(target_list, target_string):
Reported by Pylint.
Line: 8
Column: 5
import bisect
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
print("%s failed: %s" % (bf.node, bf.errstr))
def insort_wrapper(target_list, target_string):
"""
Reported by Pylint.
Line: 9
Column: 9
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
print("%s failed: %s" % (bf.node, bf.errstr))
def insort_wrapper(target_list, target_string):
"""
Removes instances of empty list inside the list before handing it to insort.
Reported by Pylint.
Line: 16
Column: 5
"""
Removes instances of empty list inside the list before handing it to insort.
"""
from SCons.Util import flatten
target_list[:] = flatten(target_list)
bisect.insort(target_list, target_string)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_cursor09.py
7 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 wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios
# test_cursor09.py
# JIRA WT-2217: insert resets key/value "set".
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 wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios
# test_cursor09.py
# JIRA WT-2217: insert resets key/value "set".
Reported by Pylint.
Line: 35
Column: 1
# test_cursor09.py
# JIRA WT-2217: insert resets key/value "set".
class test_cursor09(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
('file-r', dict(type='file:', keyfmt='r', dataset=SimpleDataSet)),
('file-S', dict(type='file:', keyfmt='S', dataset=SimpleDataSet)),
('lsm-S', dict(type='lsm:', keyfmt='S', dataset=SimpleDataSet)),
('table-r', dict(type='table:', keyfmt='r', dataset=SimpleDataSet)),
Reported by Pylint.
Line: 35
Column: 1
# test_cursor09.py
# JIRA WT-2217: insert resets key/value "set".
class test_cursor09(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
('file-r', dict(type='file:', keyfmt='r', dataset=SimpleDataSet)),
('file-S', dict(type='file:', keyfmt='S', dataset=SimpleDataSet)),
('lsm-S', dict(type='lsm:', keyfmt='S', dataset=SimpleDataSet)),
('table-r', dict(type='table:', keyfmt='r', dataset=SimpleDataSet)),
Reported by Pylint.
Line: 52
Column: 5
# WT_CURSOR.insert doesn't leave the cursor positioned, verify any
# subsequent cursor operation fails with a "key not set" message.
def test_cursor09(self):
uri = self.type + 'cursor09'
ds = self.dataset(self, uri, 100, key_format=self.keyfmt)
ds.populate()
Reported by Pylint.
Line: 55
Column: 9
def test_cursor09(self):
uri = self.type + 'cursor09'
ds = self.dataset(self, uri, 100, key_format=self.keyfmt)
ds.populate()
cursor = self.session.open_cursor(uri, None, None)
cursor[ds.key(10)] = ds.value(10)
msg = '/requires key be set/'
Reported by Pylint.
src/third_party/gperftools/dist/src/symbolize.cc
7 issues
Line: 149
Column: 7
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
PrintError("Cannot figure out the name of this executable (argv0)");
return 0;
}
if (access(get_pprof_path(), R_OK) != 0) {
PrintError("Cannot find 'pprof' (is PPROF_PATH set correctly?)");
return 0;
}
// All this work is to do two-way communication. ugh.
Reported by FlawFinder.
Line: 211
Column: 7
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
unsetenv("HEAPPROFILE");
unsetenv("HEAPCHECK");
unsetenv("PERFTOOLS_VERBOSE");
execlp(get_pprof_path(), get_pprof_path(),
"--symbols", argv0, NULL);
_exit(3); // if execvp fails, it's bad news for us
}
default: { // parent
close(child_in[0]); // child uses the 0's, parent uses the 1's
Reported by FlawFinder.
Line: 247
Column: 20
CWE codes:
134
Suggestion:
Use a constant for the format specification
int written = 0;
for (SymbolMap::const_iterator iter = symbolization_table_.begin();
iter != symbolization_table_.end(); ++iter) {
written += snprintf(pprof_buffer + written, kOutBufSize - written,
// pprof expects format to be 0xXXXXXX
"0x%" PRIxPTR "\n", reinterpret_cast<uintptr_t>(iter->first));
}
write(child_in[1], pprof_buffer, strlen(pprof_buffer));
close(child_in[1]); // that's all we need to write
Reported by FlawFinder.
Line: 95
Column: 10
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
#elif defined(__MACH__)
// We don't want to allocate memory for this since we may be
// calculating it when memory is corrupted.
static char program_invocation_name[PATH_MAX];
if (program_invocation_name[0] == '\0') { // first time calculating
uint32_t length = sizeof(program_invocation_name);
if (_NSGetExecutablePath(program_invocation_name, &length))
return NULL;
}
Reported by FlawFinder.
Line: 103
Column: 10
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
}
return program_invocation_name;
#elif defined(__FreeBSD__)
static char program_invocation_name[PATH_MAX];
size_t len = sizeof(program_invocation_name);
static const int name[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
if (!sysctl(name, 4, program_invocation_name, &len, NULL, 0))
return program_invocation_name;
return NULL;
Reported by FlawFinder.
Line: 251
Column: 40
CWE codes:
126
// pprof expects format to be 0xXXXXXX
"0x%" PRIxPTR "\n", reinterpret_cast<uintptr_t>(iter->first));
}
write(child_in[1], pprof_buffer, strlen(pprof_buffer));
close(child_in[1]); // that's all we need to write
delete[] pprof_buffer;
const int kSymbolBufferSize = kSymbolSize * symbolization_table_.size();
int total_bytes_read = 0;
Reported by FlawFinder.
Line: 261
Column: 26
CWE codes:
120
20
symbol_buffer_ = new char[kSymbolBufferSize];
memset(symbol_buffer_, '\0', kSymbolBufferSize);
while (1) {
int bytes_read = read(child_out[1], symbol_buffer_ + total_bytes_read,
kSymbolBufferSize - total_bytes_read);
if (bytes_read < 0) {
close(child_out[1]);
PrintError("Cannot read data from pprof");
return 0;
Reported by FlawFinder.