The following issues were found
src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/_spinner.py
16 issues
Line: 41
Column: 1
% (function,))
def not_reentrant(function, _calls={}):
"""Decorates a function as not being re-entrant.
The decorated function will raise an error if called from within itself.
"""
def decorated(*args, **kwargs):
Reported by Pylint.
Line: 119
Column: 1
return result, errors
class TimeoutError(Exception):
"""Raised when run_in_reactor takes too long to run a function."""
def __init__(self, function, timeout):
Exception.__init__(self,
"%r took longer than %s seconds" % (function, timeout))
Reported by Pylint.
Line: 205
Column: 29
self._cancel_timeout()
self._success = result
def _stop_reactor(self, ignored=None):
"""Stop the reactor!"""
self._reactor.crash()
def _timed_out(self, function, timeout):
e = TimeoutError(function, timeout)
Reported by Pylint.
Line: 223
Column: 13
work (e.g. cancelling a call, actually closing a connection) for the
reactor to do.
"""
for i in range(self._OBLIGATORY_REACTOR_ITERATIONS):
self._reactor.iterate(0)
junk = []
for delayed_call in self._reactor.getDelayedCalls():
delayed_call.cancel()
junk.append(delayed_call)
Reported by Pylint.
Line: 236
Column: 17
junk.append(selectable)
if IReactorThreads.providedBy(self._reactor):
if self._reactor.threadpool is not None:
self._reactor._stopThreadPool()
self._junk.extend(junk)
return junk
def clear_junk(self):
"""Clear out our recorded junk.
Reported by Pylint.
Line: 25
Column: 1
from testtools.monkey import MonkeyPatcher
from twisted.internet import defer
from twisted.internet.base import DelayedCall
from twisted.internet.interfaces import IReactorThreads
from twisted.python.failure import Failure
from twisted.python.util import mergeFunctionMetadata
Reported by Pylint.
Line: 26
Column: 1
from testtools.monkey import MonkeyPatcher
from twisted.internet import defer
from twisted.internet.base import DelayedCall
from twisted.internet.interfaces import IReactorThreads
from twisted.python.failure import Failure
from twisted.python.util import mergeFunctionMetadata
Reported by Pylint.
Line: 27
Column: 1
from twisted.internet import defer
from twisted.internet.base import DelayedCall
from twisted.internet.interfaces import IReactorThreads
from twisted.python.failure import Failure
from twisted.python.util import mergeFunctionMetadata
class ReentryError(Exception):
Reported by Pylint.
Line: 28
Column: 1
from twisted.internet import defer
from twisted.internet.base import DelayedCall
from twisted.internet.interfaces import IReactorThreads
from twisted.python.failure import Failure
from twisted.python.util import mergeFunctionMetadata
class ReentryError(Exception):
"""Raised when we try to re-enter a function that forbids it."""
Reported by Pylint.
Line: 29
Column: 1
from twisted.internet.base import DelayedCall
from twisted.internet.interfaces import IReactorThreads
from twisted.python.failure import Failure
from twisted.python.util import mergeFunctionMetadata
class ReentryError(Exception):
"""Raised when we try to re-enter a function that forbids it."""
Reported by Pylint.
src/third_party/boost/boost/regex/v4/w32_regex_traits.hpp
16 issues
Line: 276
Column: 4
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:
regex_constants::syntax_type m_char_map[1u << CHAR_BIT];
char m_lower_map[1u << CHAR_BIT];
boost::uint16_t m_type_map[1u << CHAR_BIT];
template <class U>
void init();
};
Reported by FlawFinder.
Line: 792
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
//
// fill in lower case map:
//
char char_map[1 << CHAR_BIT];
for (int ii = 0; ii < (1 << CHAR_BIT); ++ii)
char_map[ii] = static_cast<char>(ii);
#ifndef BOOST_NO_ANSI_APIS
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
BOOST_REGEX_ASSERT(r != 0);
Reported by FlawFinder.
Line: 803
Column: 22
CWE codes:
120
BOOST_REGEX_ASSERT(code_page != 0);
WCHAR wide_char_map[1 << CHAR_BIT];
int conv_r = ::MultiByteToWideChar(code_page, 0, char_map, 1 << CHAR_BIT, wide_char_map, 1 << CHAR_BIT);
BOOST_REGEX_ASSERT(conv_r != 0);
WCHAR wide_lower_map[1 << CHAR_BIT];
int r = ::LCMapStringW(this->m_locale, LCMAP_LOWERCASE, wide_char_map, 1 << CHAR_BIT, wide_lower_map, 1 << CHAR_BIT);
BOOST_REGEX_ASSERT(r != 0);
Reported by FlawFinder.
Line: 847
Column: 13
CWE codes:
120
return false;
WCHAR wide_c;
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
return false;
WORD mask;
if (::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER))
return true;
Reported by FlawFinder.
Line: 878
Column: 13
CWE codes:
120
return false;
WCHAR wide_c;
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
return false;
WORD mask;
if (::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER))
return true;
Reported by FlawFinder.
Line: 908
Column: 13
CWE codes:
120
return result;
#else
LPWSTR wide_name = (LPWSTR)_alloca((name.size() + 1) * sizeof(WCHAR));
if (::MultiByteToWideChar(CP_ACP, 0, name.c_str(), name.size(), wide_name, name.size() + 1) == 0)
return cat_type();
cat_type result(::LoadLibraryW(wide_name), &free_module);
return result;
#endif
Reported by FlawFinder.
Line: 919
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
inline std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::string& def)
{
#ifndef BOOST_NO_ANSI_APIS
char buf[256];
if (0 == ::LoadStringA(
static_cast<HMODULE>(cat.get()),
i,
buf,
256
Reported by FlawFinder.
Line: 952
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
#ifndef BOOST_NO_WREGEX
inline std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::wstring& def)
{
wchar_t buf[256];
if (0 == ::LoadStringW(
static_cast<HMODULE>(cat.get()),
i,
buf,
256
Reported by FlawFinder.
Line: 994
Column: 13
CWE codes:
120
int src_len = static_cast<int>(p2 - p1);
LPWSTR wide_p1 = (LPWSTR)_alloca((src_len + 1) * 2);
if (::MultiByteToWideChar(code_page, 0, p1, src_len, wide_p1, src_len + 1) == 0)
return std::string(p1, p2);
int bytes = ::LCMapStringW(
idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
Reported by FlawFinder.
Line: 1062
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
#endif
inline char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx)
{
char result[2];
#ifndef BOOST_NO_ANSI_APIS
int b = ::LCMapStringA(
idx, // locale identifier
LCMAP_LOWERCASE, // mapping transformation type
&c, // source string
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_stat05.py
16 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 itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
Reported by Pylint.
Line: 32
Column: 1
import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
# test_stat05.py
# Statistics cursor using size only
class test_stat_cursor_config(wttest.WiredTigerTestCase):
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 itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
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 itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
# test_stat05.py
Reported by Pylint.
Line: 32
Column: 1
import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
# test_stat05.py
# Statistics cursor using size only
class test_stat_cursor_config(wttest.WiredTigerTestCase):
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 itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
Reported by Pylint.
Line: 32
Column: 1
import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wiredtiger import stat
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
# test_stat05.py
# Statistics cursor using size only
class test_stat_cursor_config(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 37
Column: 1
# test_stat05.py
# Statistics cursor using size only
class test_stat_cursor_config(wttest.WiredTigerTestCase):
pfx = 'test_stat_cursor_size'
conn_config = 'statistics=(fast)'
uri = [
('file', dict(uri='file:' + pfx, dataset=SimpleDataSet, cfg='')),
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/dvips.py
16 issues
Line: 60
Column: 5
def generate(env):
"""Add Builders and construction variables for dvips to an Environment."""
global PSAction
if PSAction is None:
PSAction = SCons.Action.Action('$PSCOM', '$PSCOMSTR')
global DVIPSAction
if DVIPSAction is None:
Reported by Pylint.
Line: 64
Column: 5
if PSAction is None:
PSAction = SCons.Action.Action('$PSCOM', '$PSCOMSTR')
global DVIPSAction
if DVIPSAction is None:
DVIPSAction = SCons.Action.Action(DviPsFunction, strfunction = DviPsStrFunction)
global PSBuilder
if PSBuilder is None:
Reported by Pylint.
Line: 68
Column: 5
if DVIPSAction is None:
DVIPSAction = SCons.Action.Action(DviPsFunction, strfunction = DviPsStrFunction)
global PSBuilder
if PSBuilder is None:
PSBuilder = SCons.Builder.Builder(action = PSAction,
prefix = '$PSPREFIX',
suffix = '$PSSUFFIX',
src_suffix = '.dvi',
Reported by Pylint.
Line: 34
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/dvips.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import SCons.Action
import SCons.Builder
import SCons.Tool.dvipdf
import SCons.Util
Reported by Pylint.
Line: 41
Column: 1
import SCons.Tool.dvipdf
import SCons.Util
def DviPsFunction(target = None, source= None, env=None):
result = SCons.Tool.dvipdf.DviPdfPsFunction(PSAction,target,source,env)
return result
def DviPsStrFunction(target = None, source= None, env=None):
"""A strfunction for dvipdf that returns the appropriate
Reported by Pylint.
Line: 41
Column: 1
import SCons.Tool.dvipdf
import SCons.Util
def DviPsFunction(target = None, source= None, env=None):
result = SCons.Tool.dvipdf.DviPdfPsFunction(PSAction,target,source,env)
return result
def DviPsStrFunction(target = None, source= None, env=None):
"""A strfunction for dvipdf that returns the appropriate
Reported by Pylint.
Line: 45
Column: 1
result = SCons.Tool.dvipdf.DviPdfPsFunction(PSAction,target,source,env)
return result
def DviPsStrFunction(target = None, source= None, env=None):
"""A strfunction for dvipdf that returns the appropriate
command string for the no_exec options."""
if env.GetOption("no_exec"):
result = env.subst('$PSCOM',0,target,source)
else:
Reported by Pylint.
Line: 54
Column: 1
result = ''
return result
PSAction = None
DVIPSAction = None
PSBuilder = None
def generate(env):
"""Add Builders and construction variables for dvips to an Environment."""
Reported by Pylint.
Line: 55
Column: 1
return result
PSAction = None
DVIPSAction = None
PSBuilder = None
def generate(env):
"""Add Builders and construction variables for dvips to an Environment."""
global PSAction
Reported by Pylint.
Line: 56
Column: 1
PSAction = None
DVIPSAction = None
PSBuilder = None
def generate(env):
"""Add Builders and construction variables for dvips to an Environment."""
global PSAction
if PSAction is None:
Reported by Pylint.
src/third_party/boost/boost/regex/icu.hpp
16 issues
Line: 381
Column: 63
CWE codes:
126
//
inline u32regex make_u32regex(const char* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
{
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(p), opt, static_cast<boost::mpl::int_<1> const*>(0));
}
inline u32regex make_u32regex(const unsigned char* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
{
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(reinterpret_cast<const char*>(p)), opt, static_cast<boost::mpl::int_<1> const*>(0));
}
Reported by FlawFinder.
Line: 385
Column: 63
CWE codes:
126
}
inline u32regex make_u32regex(const unsigned char* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
{
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(reinterpret_cast<const char*>(p)), opt, static_cast<boost::mpl::int_<1> const*>(0));
}
//
// construction from UTF-16 nul-terminated strings:
//
#ifndef BOOST_NO_WREGEX
Reported by FlawFinder.
Line: 393
Column: 63
CWE codes:
126
#ifndef BOOST_NO_WREGEX
inline u32regex make_u32regex(const wchar_t* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
{
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::wcslen(p), opt, static_cast<boost::mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
#if !BOOST_REGEX_UCHAR_IS_WCHAR_T
inline u32regex make_u32regex(const UChar* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
{
Reported by FlawFinder.
Line: 519
Column: 59
CWE codes:
126
const u32regex& e,
match_flag_type flags = match_default)
{
return BOOST_REGEX_DETAIL_NS::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_match(const char* p,
match_results<const char*>& m,
const u32regex& e,
Reported by FlawFinder.
Line: 527
Column: 59
CWE codes:
126
const u32regex& e,
match_flag_type flags = match_default)
{
return BOOST_REGEX_DETAIL_NS::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
}
inline bool u32regex_match(const unsigned char* p,
match_results<const unsigned char*>& m,
const u32regex& e,
match_flag_type flags = match_default)
Reported by FlawFinder.
Line: 534
Column: 59
CWE codes:
126
const u32regex& e,
match_flag_type flags = match_default)
{
return BOOST_REGEX_DETAIL_NS::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
}
inline bool u32regex_match(const std::string& s,
match_results<std::string::const_iterator>& m,
const u32regex& e,
match_flag_type flags = match_default)
Reported by FlawFinder.
Line: 583
Column: 59
CWE codes:
126
match_flag_type flags = match_default)
{
match_results<const wchar_t*> m;
return BOOST_REGEX_DETAIL_NS::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_match(const char* p,
const u32regex& e,
match_flag_type flags = match_default)
Reported by FlawFinder.
Line: 591
Column: 59
CWE codes:
126
match_flag_type flags = match_default)
{
match_results<const char*> m;
return BOOST_REGEX_DETAIL_NS::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
}
inline bool u32regex_match(const unsigned char* p,
const u32regex& e,
match_flag_type flags = match_default)
{
Reported by FlawFinder.
Line: 598
Column: 59
CWE codes:
126
match_flag_type flags = match_default)
{
match_results<const unsigned char*> m;
return BOOST_REGEX_DETAIL_NS::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
}
inline bool u32regex_match(const std::string& s,
const u32regex& e,
match_flag_type flags = match_default)
{
Reported by FlawFinder.
Line: 704
Column: 60
CWE codes:
126
const u32regex& e,
match_flag_type flags = match_default)
{
return BOOST_REGEX_DETAIL_NS::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_search(const char* p,
match_results<const char*>& m,
const u32regex& e,
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/hook_demo.py
16 issues
Line: 59
Column: 5
# Print to /dev/tty for debugging, since anything extraneous to stdout/stderr will
# cause a test error.
def tty(s):
WiredTigerTestCase.tty(s)
# These are the hook functions that are run when particular APIs are called.
# Called to manipulate args for wiredtiger_open
def wiredtiger_open_args(ignored_self, args):
Reported by Pylint.
Line: 53
Column: 1
# hooked method.
from __future__ import print_function
import os, sys, wthooks
from wttest import WiredTigerTestCase
# Print to /dev/tty for debugging, since anything extraneous to stdout/stderr will
# cause a test error.
def tty(s):
Reported by Pylint.
Line: 53
Column: 1
# hooked method.
from __future__ import print_function
import os, sys, wthooks
from wttest import WiredTigerTestCase
# Print to /dev/tty for debugging, since anything extraneous to stdout/stderr will
# cause a test error.
def tty(s):
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: 53
Column: 1
# hooked method.
from __future__ import print_function
import os, sys, wthooks
from wttest import WiredTigerTestCase
# Print to /dev/tty for debugging, since anything extraneous to stdout/stderr will
# cause a test error.
def tty(s):
Reported by Pylint.
Line: 58
Column: 1
# Print to /dev/tty for debugging, since anything extraneous to stdout/stderr will
# cause a test error.
def tty(s):
WiredTigerTestCase.tty(s)
# These are the hook functions that are run when particular APIs are called.
# Called to manipulate args for wiredtiger_open
Reported by Pylint.
Line: 58
Column: 1
# Print to /dev/tty for debugging, since anything extraneous to stdout/stderr will
# cause a test error.
def tty(s):
WiredTigerTestCase.tty(s)
# These are the hook functions that are run when particular APIs are called.
# Called to manipulate args for wiredtiger_open
Reported by Pylint.
Line: 64
Column: 1
# These are the hook functions that are run when particular APIs are called.
# Called to manipulate args for wiredtiger_open
def wiredtiger_open_args(ignored_self, args):
tty('>>> wiredtiger_open, adding cache_size')
args = list(args) # convert from a readonly tuple to a writeable list
args[-1] += ',,,cache_size=500M,,,' # modify the last arg
return args
Reported by Pylint.
Line: 71
Column: 1
return args
# Called to notify after successful wiredtiger_open
def wiredtiger_open_notify(ignored_self, ret, *args):
tty('>>> wiredtiger_open({}) returned {}'.format(args, ret))
# Called to notify after successful Session.open_cursor
def session_open_cursor_notify(self, ret, *args):
tty('>>> session.open_cursor({}) returned {}, session is {}'.format(args, ret, self))
Reported by Pylint.
Line: 75
Column: 1
tty('>>> wiredtiger_open({}) returned {}'.format(args, ret))
# Called to notify after successful Session.open_cursor
def session_open_cursor_notify(self, ret, *args):
tty('>>> session.open_cursor({}) returned {}, session is {}'.format(args, ret, self))
# Called to replace Session.create
# We do different things (described above) as indicated by our command line argument.
def session_create_replace(arg, orig_session_create, session_self, uri, config):
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/wasm/WasmValidate.h
16 issues
Line: 360
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
MOZ_MUST_USE bool read(T* out) {
if (bytesRemain() < sizeof(T))
return false;
memcpy((void*)out, cur_, sizeof(T));
cur_ += sizeof(T);
return true;
}
template <class T>
Reported by FlawFinder.
Line: 369
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
T uncheckedRead() {
MOZ_ASSERT(bytesRemain() >= sizeof(T));
T ret;
memcpy(&ret, cur_, sizeof(T));
cur_ += sizeof(T);
return ret;
}
template <class T>
Reported by FlawFinder.
Line: 377
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
template <class T>
void uncheckedRead(T* ret) {
MOZ_ASSERT(bytesRemain() >= sizeof(T));
memcpy(ret, cur_, sizeof(T));
cur_ += sizeof(T);
}
template <typename UInt>
MOZ_MUST_USE bool readVarU(UInt* out) {
Reported by FlawFinder.
Line: 673
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void uncheckedReadFixedI8x16(I8x16* i8x16) {
struct T { I8x16 v; };
T t = uncheckedRead<T>();
memcpy(i8x16, &t, sizeof(t));
}
void uncheckedReadFixedI16x8(I16x8* i16x8) {
struct T { I16x8 v; };
T t = uncheckedRead<T>();
memcpy(i16x8, &t, sizeof(t));
Reported by FlawFinder.
Line: 678
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void uncheckedReadFixedI16x8(I16x8* i16x8) {
struct T { I16x8 v; };
T t = uncheckedRead<T>();
memcpy(i16x8, &t, sizeof(t));
}
void uncheckedReadFixedI32x4(I32x4* i32x4) {
struct T { I32x4 v; };
T t = uncheckedRead<T>();
memcpy(i32x4, &t, sizeof(t));
Reported by FlawFinder.
Line: 683
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void uncheckedReadFixedI32x4(I32x4* i32x4) {
struct T { I32x4 v; };
T t = uncheckedRead<T>();
memcpy(i32x4, &t, sizeof(t));
}
void uncheckedReadFixedF32x4(F32x4* f32x4) {
struct T { F32x4 v; };
T t = uncheckedRead<T>();
memcpy(f32x4, &t, sizeof(t));
Reported by FlawFinder.
Line: 688
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void uncheckedReadFixedF32x4(F32x4* f32x4) {
struct T { F32x4 v; };
T t = uncheckedRead<T>();
memcpy(f32x4, &t, sizeof(t));
}
};
// The local entries are part of function bodies and thus serialized by both
// wasm and asm.js and decoded as part of both validation and compilation.
Reported by FlawFinder.
Line: 357
Column: 23
CWE codes:
120
20
bool resilientMode_;
template <class T>
MOZ_MUST_USE bool read(T* out) {
if (bytesRemain() < sizeof(T))
return false;
memcpy((void*)out, cur_, sizeof(T));
cur_ += sizeof(T);
return true;
Reported by FlawFinder.
Line: 503
Column: 16
CWE codes:
120
20
// attempting to align).
MOZ_MUST_USE bool readFixedU8(uint8_t* i) {
return read<uint8_t>(i);
}
MOZ_MUST_USE bool readFixedU32(uint32_t* u) {
return read<uint32_t>(u);
}
MOZ_MUST_USE bool readFixedF32(float* f) {
Reported by FlawFinder.
Line: 506
Column: 16
CWE codes:
120
20
return read<uint8_t>(i);
}
MOZ_MUST_USE bool readFixedU32(uint32_t* u) {
return read<uint32_t>(u);
}
MOZ_MUST_USE bool readFixedF32(float* f) {
return read<float>(f);
}
MOZ_MUST_USE bool readFixedF64(double* d) {
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_hs11.py
16 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 wtscenario import make_scenarios
from wiredtiger import stat
# test_hs11.py
# Ensure that updates without timestamps clear the history store records.
Reported by Pylint.
Line: 31
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
from wiredtiger import stat
# test_hs11.py
# Ensure that updates without timestamps clear the history store records.
class test_hs11(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,statistics=(all)'
Reported by Pylint.
Line: 55
Column: 24
return str(i)
return i
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: 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 wtscenario import make_scenarios
from wiredtiger import stat
# test_hs11.py
# Ensure that updates without timestamps clear the history store records.
Reported by Pylint.
Line: 31
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
from wiredtiger import stat
# test_hs11.py
# Ensure that updates without timestamps clear the history store records.
class test_hs11(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,statistics=(all)'
Reported by Pylint.
Line: 35
Column: 1
# test_hs11.py
# Ensure that updates without timestamps clear the history store records.
class test_hs11(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,statistics=(all)'
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
('integer-row', dict(key_format='i')),
Reported by Pylint.
Line: 35
Column: 1
# test_hs11.py
# Ensure that updates without timestamps clear the history store records.
class test_hs11(wttest.WiredTigerTestCase):
conn_config = 'cache_size=50MB,statistics=(all)'
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
('integer-row', dict(key_format='i')),
Reported by Pylint.
Line: 50
Column: 5
scenarios = make_scenarios(key_format_values, update_type_values)
nrows = 10000
def create_key(self, i):
if self.key_format == 'S':
return str(i)
return i
def get_stat(self, stat):
Reported by Pylint.
Line: 55
Column: 5
return str(i)
return i
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.
src/third_party/mozjs-60/extract/js/src/wasm/WasmSignalHandlers.cpp
16 issues
Line: 866
Column: 30
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// Disassemble the instruction which caused the trap so that we can extract
// information about it and decide what to do.
Disassembler::HeapAccess access;
uint8_t* end = Disassembler::DisassembleHeapAccess(pc, &access);
const Disassembler::ComplexAddress& address = access.address();
MOZ_RELEASE_ASSERT(end > pc);
MOZ_RELEASE_ASSERT(segment->containsCodePC(end));
Reported by FlawFinder.
Line: 867
Column: 61
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// Disassemble the instruction which caused the trap so that we can extract
// information about it and decide what to do.
Disassembler::HeapAccess access;
uint8_t* end = Disassembler::DisassembleHeapAccess(pc, &access);
const Disassembler::ComplexAddress& address = access.address();
MOZ_RELEASE_ASSERT(end > pc);
MOZ_RELEASE_ASSERT(segment->containsCodePC(end));
// Check x64 asm.js heap access invariants.
Reported by FlawFinder.
Line: 868
Column: 51
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// information about it and decide what to do.
Disassembler::HeapAccess access;
uint8_t* end = Disassembler::DisassembleHeapAccess(pc, &access);
const Disassembler::ComplexAddress& address = access.address();
MOZ_RELEASE_ASSERT(end > pc);
MOZ_RELEASE_ASSERT(segment->containsCodePC(end));
// Check x64 asm.js heap access invariants.
MOZ_RELEASE_ASSERT(address.disp() >= 0);
Reported by FlawFinder.
Line: 895
Column: 66
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// address of the start of the access, and the OS may sometimes give us an
// address somewhere in the middle of the heap access.
uint8_t* accessAddress = ComputeAccessAddress(context, address);
MOZ_RELEASE_ASSERT(size_t(faultingAddress - accessAddress) < access.size(),
"Given faulting address does not appear to be within computed "
"faulting address range");
MOZ_RELEASE_ASSERT(accessAddress >= instance.memoryBase(),
"Access begins outside the asm.js heap");
MOZ_RELEASE_ASSERT(accessAddress + access.size() <= instance.memoryBase() +
Reported by FlawFinder.
Line: 900
Column: 40
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
"faulting address range");
MOZ_RELEASE_ASSERT(accessAddress >= instance.memoryBase(),
"Access begins outside the asm.js heap");
MOZ_RELEASE_ASSERT(accessAddress + access.size() <= instance.memoryBase() +
instance.memoryMappedSize(),
"Access extends beyond the asm.js heap guard region");
MOZ_RELEASE_ASSERT(accessAddress + access.size() > instance.memoryBase() +
memoryLength,
"Computed access address is not actually out of bounds");
Reported by FlawFinder.
Line: 903
Column: 40
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MOZ_RELEASE_ASSERT(accessAddress + access.size() <= instance.memoryBase() +
instance.memoryMappedSize(),
"Access extends beyond the asm.js heap guard region");
MOZ_RELEASE_ASSERT(accessAddress + access.size() > instance.memoryBase() +
memoryLength,
"Computed access address is not actually out of bounds");
// The basic sandbox model is that all heap accesses are a heap base
// register plus an index, and the index is always computed with 32-bit
Reported by FlawFinder.
Line: 923
Column: 19
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
// be hitting this anyway.
intptr_t unwrappedOffset = accessAddress - instance.memoryBase().unwrap(/* for value */);
uint32_t wrappedOffset = uint32_t(unwrappedOffset);
size_t size = access.size();
MOZ_RELEASE_ASSERT(wrappedOffset + size > wrappedOffset);
bool inBounds = wrappedOffset + size < memoryLength;
if (inBounds) {
// We now know that this is an access that is actually in bounds when
Reported by FlawFinder.
Line: 935
Column: 17
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MOZ_RELEASE_ASSERT(wrappedAddress >= instance.memoryBase());
MOZ_RELEASE_ASSERT(wrappedAddress + size > wrappedAddress);
MOZ_RELEASE_ASSERT(wrappedAddress + size <= instance.memoryBase() + memoryLength);
switch (access.kind()) {
case Disassembler::HeapAccess::Load:
SetRegisterToLoadedValue(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
break;
case Disassembler::HeapAccess::LoadSext32:
SetRegisterToLoadedValueSext32(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
Reported by FlawFinder.
Line: 937
Column: 83
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
MOZ_RELEASE_ASSERT(wrappedAddress + size <= instance.memoryBase() + memoryLength);
switch (access.kind()) {
case Disassembler::HeapAccess::Load:
SetRegisterToLoadedValue(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
break;
case Disassembler::HeapAccess::LoadSext32:
SetRegisterToLoadedValueSext32(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
break;
case Disassembler::HeapAccess::Store:
Reported by FlawFinder.
Line: 940
Column: 89
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
SetRegisterToLoadedValue(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
break;
case Disassembler::HeapAccess::LoadSext32:
SetRegisterToLoadedValueSext32(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
break;
case Disassembler::HeapAccess::Store:
StoreValueFromRegister(context, wrappedAddress.cast<void*>(), size, access.otherOperand());
break;
case Disassembler::HeapAccess::LoadSext64:
Reported by FlawFinder.
src/third_party/timelib-2021.06/parse_zoneinfo.c
16 issues
Line: 282
CWE codes:
401
if (S_ISDIR(st.st_mode)) {
if (dirstack_top == dirstack_size) {
dirstack_size *= 2;
dirstack = timelib_realloc(dirstack, dirstack_size * sizeof(*dirstack));
}
dirstack[dirstack_top++] = timelib_strdup(name);
} else {
if (index_next == index_size) {
index_size *= 2;
Reported by Cppcheck.
Line: 288
CWE codes:
401
} else {
if (index_next == index_size) {
index_size *= 2;
db_index = timelib_realloc(db_index, index_size * sizeof(timelib_tzdb_index_entry));
}
db_index[index_next].id = timelib_strdup(name);
{
Reported by Cppcheck.
Line: 90
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
static int is_valid_tzfile(const struct stat *st, int fd)
{
if (fd) {
char buf[20];
if (read(fd, buf, 20) != 20) {
return 0;
}
lseek(fd, SEEK_SET, 0);
if (memcmp(buf, "TZif", 4)) {
Reported by FlawFinder.
Line: 130
Column: 7
CWE codes:
362
/* O_BINARY is required to properly read the file on windows */
#ifdef _WIN32
fd = open(fname, O_RDONLY | O_BINARY);
#else
fd = open(fname, O_RDONLY);
#endif
timelib_free(fname);
Reported by FlawFinder.
Line: 132
Column: 7
CWE codes:
362
#ifdef _WIN32
fd = open(fname, O_RDONLY | O_BINARY);
#else
fd = open(fname, O_RDONLY);
#endif
timelib_free(fname);
if (fd == -1) {
return NULL;
Reported by FlawFinder.
Line: 162
Column: 2
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
struct dirent **entries = NULL;
int entries_size = 0;
int entries_count = 0;
char entry_container[sizeof(struct dirent) + MAXPATHLEN];
struct dirent *entry = (struct dirent *)&entry_container;
dir = opendir(directory_name);
if (!dir) {
return -1;
Reported by FlawFinder.
Line: 204
Column: 48
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
goto cleanup;
}
entries[entries_count++] = (struct dirent *) memcpy(new_entry, entry, new_entry_size);
}
closedir(dir);
*namelist = entries;
Reported by FlawFinder.
Line: 249
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
do {
struct dirent **ents;
char name[PATH_MAX], *top;
int count;
/* Pop the top stack entry, and iterate through its contents. */
top = dirstack[--dirstack_top];
snprintf(name, sizeof(name), "%s/%s", directory, top);
Reported by FlawFinder.
Line: 299
Column: 8
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (tzfile_data) {
tmp_data = timelib_realloc(tmp_data, data_size + length);
memcpy(tmp_data + data_size, tzfile_data, length);
db_index[index_next].pos = data_size;
data_size += length;
timelib_free(tzfile_data);
index_next++;
Reported by FlawFinder.