The following issues were found
src/third_party/icu4c-57.1/source/common/ucnv2022.cpp
10 issues
Line: 218
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
UBool isFirstBuffer;
#endif
UBool isEmptySegment;
char name[30];
char locale[3];
}UConverterDataISO2022;
/* Protos */
/* ISO-2022 ----------------------------------------------------------------- */
Reported by FlawFinder.
Line: 219
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
#endif
UBool isEmptySegment;
char name[30];
char locale[3];
}UConverterDataISO2022;
/* Protos */
/* ISO-2022 ----------------------------------------------------------------- */
Reported by FlawFinder.
Line: 474
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
static void
_ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
char myLocale[6]={' ',' ',' ',' ',' ',' '};
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISO2022));
if(cnv->extraInfo != NULL) {
UConverterNamePieces stackPieces;
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
Reported by FlawFinder.
Line: 1550
Column: 37
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
* byte values and need not be tested explicitly.
*/
static inline void
_2022ToSJIS(uint8_t c1, uint8_t c2, char bytes[2]) {
if(c1&1) {
++c1;
if(c2 <= 0x5f) {
c2 += 0x1f;
} else if(c2 <= 0x7e) {
Reported by FlawFinder.
Line: 1663
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
const UChar* sourceLimit = args->sourceLimit;
int32_t* offsets = args->offsets;
UChar32 sourceChar;
char buffer[8];
int32_t len, outLen;
int8_t choices[10];
int32_t choiceCount;
uint32_t targetValue = 0;
UBool useFallback;
Reported by FlawFinder.
Line: 2072
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
static void
UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[2];
const char *mySource = (char *) args->source;
UChar *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
uint32_t targetUniChar = 0x0000;
uint32_t mySourceChar = 0x0000;
Reported by FlawFinder.
Line: 2665
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
static void
UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[2];
const char *mySource = ( char *) args->source;
UChar *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
UChar32 targetUniChar = 0x0000;
UChar mySourceChar = 0x0000;
Reported by FlawFinder.
Line: 2915
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
const UChar* sourceLimit = args->sourceLimit;
int32_t* offsets = args->offsets;
UChar32 sourceChar;
char buffer[8];
int32_t len;
int8_t choices[3];
int32_t choiceCount;
uint32_t targetValue = 0;
UBool useFallback;
Reported by FlawFinder.
Line: 3258
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
static void
UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[3];
const char *mySource = (char *) args->source;
UChar *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
uint32_t targetUniChar = 0x0000;
uint32_t mySourceChar = 0x0000;
Reported by FlawFinder.
Line: 3463
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
UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) cnv->extraInfo;
ISO2022State *pFromU2022State=&myConverterData->fromU2022State;
char *p, *subchar;
char buffer[8];
int32_t length;
subchar=(char *)cnv->subChars;
length=cnv->subCharLen; /* assume length==1 for most variants */
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/fortran.py
10 issues
Line: 36
Column: 1
__revision__ = "src/engine/SCons/Tool/fortran.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import re
import SCons.Action
import SCons.Defaults
import SCons.Scanner.Fortran
import SCons.Tool
Reported by Pylint.
Line: 38
Column: 1
import re
import SCons.Action
import SCons.Defaults
import SCons.Scanner.Fortran
import SCons.Tool
import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env
Reported by Pylint.
Line: 39
Column: 1
import re
import SCons.Action
import SCons.Defaults
import SCons.Scanner.Fortran
import SCons.Tool
import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env
Reported by Pylint.
Line: 40
Column: 1
import SCons.Action
import SCons.Defaults
import SCons.Scanner.Fortran
import SCons.Tool
import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env
compilers = ['f95', 'f90', 'f77']
Reported by Pylint.
Line: 41
Column: 1
import SCons.Action
import SCons.Defaults
import SCons.Scanner.Fortran
import SCons.Tool
import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env
compilers = ['f95', 'f90', 'f77']
Reported by Pylint.
Line: 42
Column: 1
import SCons.Defaults
import SCons.Scanner.Fortran
import SCons.Tool
import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env
compilers = ['f95', 'f90', 'f77']
def generate(env):
Reported by Pylint.
Line: 34
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/fortran.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import re
import SCons.Action
import SCons.Defaults
Reported by Pylint.
Line: 47
Column: 1
compilers = ['f95', 'f90', 'f77']
def generate(env):
add_all_to_env(env)
add_fortran_to_env(env)
fc = env.Detect(compilers) or 'f77'
env['SHFORTRAN'] = fc
Reported by Pylint.
Line: 51
Column: 5
add_all_to_env(env)
add_fortran_to_env(env)
fc = env.Detect(compilers) or 'f77'
env['SHFORTRAN'] = fc
env['FORTRAN'] = fc
def exists(env):
return env.Detect(compilers)
Reported by Pylint.
Line: 55
Column: 1
env['SHFORTRAN'] = fc
env['FORTRAN'] = fc
def exists(env):
return env.Detect(compilers)
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
Reported by Pylint.
src/mongo/db/storage/storage_engine_metadata_test.cpp
10 issues
Line: 52
using namespace mongo;
TEST(StorageEngineMetadataTest, ReadNonExistentMetadataFile) {
StorageEngineMetadata metadata("no_such_directory");
Status status = metadata.read();
ASSERT_NOT_OK(status);
ASSERT_EQUALS(ErrorCodes::NonExistentPath, status.code());
}
Reported by Cppcheck.
Line: 54
Column: 30
CWE codes:
120
20
TEST(StorageEngineMetadataTest, ReadNonExistentMetadataFile) {
StorageEngineMetadata metadata("no_such_directory");
Status status = metadata.read();
ASSERT_NOT_OK(status);
ASSERT_EQUALS(ErrorCodes::NonExistentPath, status.code());
}
TEST(StorageEngineMetadataTest, WriteToNonexistentDirectory) {
Reported by FlawFinder.
Line: 76
Column: 32
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_NOT_OK(metadata.read());
}
}
TEST(StorageEngineMetadataTest, InvalidMetadataFileStorageFieldMissing) {
TempDir tempDir("StorageEngineMetadataTest_InvalidMetadataFileStorageFieldMissing");
Reported by FlawFinder.
Line: 91
Column: 32
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_NOT_OK(metadata.read());
}
}
TEST(StorageEngineMetadataTest, InvalidMetadataFileStorageNodeNotObject) {
TempDir tempDir("StorageEngineMetadataTest_InvalidMetadataFileStorageNodeNotObject");
Reported by FlawFinder.
Line: 106
Column: 32
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_NOT_OK(metadata.read());
}
}
TEST(StorageEngineMetadataTest, InvalidMetadataFileStorageEngineFieldMissing) {
TempDir tempDir("StorageEngineMetadataTest_InvalidMetadataFileStorageEngineFieldMissing");
Reported by FlawFinder.
Line: 121
Column: 32
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_NOT_OK(metadata.read());
}
}
TEST(StorageEngineMetadataTest, InvalidMetadataFileStorageEngineFieldNotString) {
TempDir tempDir("StorageEngineMetadataTest_InvalidMetadataFileStorageEngineFieldNotString");
Reported by FlawFinder.
Line: 136
Column: 32
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_NOT_OK(metadata.read());
}
}
TEST(StorageEngineMetadataTest, InvalidMetadataFileStorageEngineOptionsFieldNotObject) {
TempDir tempDir("StorageEngineMetadataTest_IgnoreUnknownField");
Reported by FlawFinder.
Line: 151
Column: 32
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_NOT_OK(metadata.read());
}
}
// Metadata parser should ignore unknown metadata fields.
TEST(StorageEngineMetadataTest, IgnoreUnknownField) {
Reported by FlawFinder.
Line: 167
Column: 28
CWE codes:
120
20
}
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_OK(metadata.read());
ASSERT_EQUALS("storageEngine1", metadata.getStorageEngine());
ASSERT_TRUE(metadata.getStorageEngineOptions().isEmpty());
}
}
Reported by FlawFinder.
Line: 193
Column: 28
CWE codes:
120
20
// Read back storage engine name.
{
StorageEngineMetadata metadata(tempDir.path());
ASSERT_OK(metadata.read());
ASSERT_EQUALS("storageEngine1", metadata.getStorageEngine());
ASSERT_BSONOBJ_EQ(options, metadata.getStorageEngineOptions());
metadata.reset();
ASSERT_TRUE(metadata.getStorageEngine().empty());
Reported by FlawFinder.
src/mongo/db/storage/sorted_data_interface_test_keyformat_string.cpp
10 issues
Line: 113
}
}
TEST(SortedDataInterface, KeyFormatStringSetEndPosition) {
const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(
/*unique=*/false, /*partial=*/false, KeyFormat::String));
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
ASSERT(sorted->isEmpty(opCtx.get()));
Reported by Cppcheck.
Line: 49
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
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
ASSERT(sorted->isEmpty(opCtx.get()));
char buf1[12];
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
Reported by FlawFinder.
Line: 51
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
char buf1[12];
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
RecordId rid1(buf1, 12);
Reported by FlawFinder.
Line: 53
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
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
RecordId rid1(buf1, 12);
RecordId rid2(buf2, 12);
RecordId rid3(buf3, 12);
Reported by FlawFinder.
Line: 120
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
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
ASSERT(sorted->isEmpty(opCtx.get()));
char buf1[12];
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
Reported by FlawFinder.
Line: 122
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
char buf1[12];
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
RecordId rid1(buf1, 12);
Reported by FlawFinder.
Line: 124
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
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
RecordId rid1(buf1, 12);
RecordId rid2(buf2, 12);
RecordId rid3(buf3, 12);
Reported by FlawFinder.
Line: 189
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
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
ASSERT(sorted->isEmpty(opCtx.get()));
char buf1[12];
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
Reported by FlawFinder.
Line: 191
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
char buf1[12];
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
RecordId rid1(buf1, 12);
Reported by FlawFinder.
Line: 193
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
memset(buf1, 0, 12);
char buf2[12];
memset(buf2, 1, 12);
char buf3[12];
memset(buf3, 0xff, 12);
RecordId rid1(buf1, 12);
RecordId rid2(buf2, 12);
RecordId rid3(buf3, 12);
Reported by FlawFinder.
src/third_party/gperftools/dist/src/windows/port.h
9 issues
Line: 105
Column: 72
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
/* ----------------------------------- BASIC TYPES */
#ifndef HAVE_STDINT_H
# error Do not know how to set up type aliases. Edit port.h for your system.
#endif
/* I guess MSVC's <types.h> doesn't include ssize_t by default? */
#ifdef _MSC_VER
typedef intptr_t ssize_t;
Reported by FlawFinder.
Line: 350
Column: 12
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#if __STDC__ && !defined(__MINGW32__)
/* These functions are considered non-standard */
inline int access(const char *pathname, int mode) {
return _access(pathname, mode);
}
inline int open(const char *pathname, int flags, int mode = 0) {
return _open(pathname, flags, mode);
}
Reported by FlawFinder.
Line: 375
Column: 14
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
return _mkdir(pathname);
}
inline FILE *popen(const char *command, const char *type) {
return _popen(command, type);
}
inline int pclose(FILE *stream) {
return _pclose(stream);
}
Reported by FlawFinder.
Line: 239
Column: 28
CWE codes:
Suggestion:
Use InitializeCriticalSectionAndSpinCount instead
return true;
}
private:
void InitializeMutex() { InitializeCriticalSection(&mutex_); }
pthread_once_t initialize_token_;
CRITICAL_SECTION mutex_;
};
Reported by FlawFinder.
Line: 408
Column: 42
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
/* ----------------------------------- OTHER */
inline void srandom(unsigned int seed) { srand(seed); }
inline long random(void) { return rand(); }
#ifndef HAVE_DECL_SLEEP
#define HAVE_DECL_SLEEP 0
#endif
Reported by FlawFinder.
Line: 408
Column: 13
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
/* ----------------------------------- OTHER */
inline void srandom(unsigned int seed) { srand(seed); }
inline long random(void) { return rand(); }
#ifndef HAVE_DECL_SLEEP
#define HAVE_DECL_SLEEP 0
#endif
Reported by FlawFinder.
Line: 409
Column: 13
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
/* ----------------------------------- OTHER */
inline void srandom(unsigned int seed) { srand(seed); }
inline long random(void) { return rand(); }
#ifndef HAVE_DECL_SLEEP
#define HAVE_DECL_SLEEP 0
#endif
Reported by FlawFinder.
Line: 353
Column: 12
CWE codes:
362
inline int access(const char *pathname, int mode) {
return _access(pathname, mode);
}
inline int open(const char *pathname, int flags, int mode = 0) {
return _open(pathname, flags, mode);
}
inline int close(int fd) {
return _close(fd);
}
Reported by FlawFinder.
Line: 359
Column: 16
CWE codes:
120
20
inline int close(int fd) {
return _close(fd);
}
inline ssize_t read(int fd, void *buf, size_t count) {
return _read(fd, buf, count);
}
inline ssize_t write(int fd, const void *buf, size_t count) {
return _write(fd, buf, count);
}
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_hs15.py
9 issues
Line: 34
Column: 1
# [END_TAGS]
#
import time, wiredtiger, wttest
from wtscenario import make_scenarios
# test_hs15.py
# Ensure eviction doesn't clear the history store again after checkpoint has done so because of the same update without timestamp.
class test_hs15(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 34
Column: 1
# [END_TAGS]
#
import time, wiredtiger, wttest
from wtscenario import make_scenarios
# test_hs15.py
# Ensure eviction doesn't clear the history store again after checkpoint has done so because of the same update without timestamp.
class test_hs15(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: 34
Column: 1
# [END_TAGS]
#
import time, wiredtiger, wttest
from wtscenario import make_scenarios
# test_hs15.py
# Ensure eviction doesn't clear the history store again after checkpoint has done so because of the same update without timestamp.
class test_hs15(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 38
Column: 1
from wtscenario import make_scenarios
# test_hs15.py
# Ensure eviction doesn't clear the history store again after checkpoint has done so because of the same update without timestamp.
class test_hs15(wttest.WiredTigerTestCase):
conn_config = 'cache_size=5MB'
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
Reported by Pylint.
Line: 39
Column: 1
# test_hs15.py
# Ensure eviction doesn't clear the history store again after checkpoint has done so because of the same update without timestamp.
class test_hs15(wttest.WiredTigerTestCase):
conn_config = 'cache_size=5MB'
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
('string-row', dict(key_format='S'))
Reported by Pylint.
Line: 39
Column: 1
# test_hs15.py
# Ensure eviction doesn't clear the history store again after checkpoint has done so because of the same update without timestamp.
class test_hs15(wttest.WiredTigerTestCase):
conn_config = 'cache_size=5MB'
session_config = 'isolation=snapshot'
key_format_values = [
('column', dict(key_format='r')),
('string-row', dict(key_format='S'))
Reported by Pylint.
Line: 48
Column: 5
]
scenarios = make_scenarios(key_format_values)
def create_key(self, i):
if self.key_format == 'S':
return str(i)
return i
def test_hs15(self):
Reported by Pylint.
Line: 53
Column: 5
return str(i)
return i
def test_hs15(self):
uri = 'table:test_hs15'
self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
cursor = self.session.open_cursor(uri)
value1 = 'a' * 500
Reported by Pylint.
site_scons/site_tools/dagger/__init__.py
9 issues
Line: 28
Column: 1
import os
import logging
import SCons
from . import dagger
def generate(env, **kwargs):
Reported by Pylint.
Line: 30
Column: 1
import SCons
from . import dagger
def generate(env, **kwargs):
"""The entry point for our tool. However, the builder for
the JSON file is not actually run until the Dagger method is called
Reported by Pylint.
Line: 33
Column: 1
from . import dagger
def generate(env, **kwargs):
"""The entry point for our tool. However, the builder for
the JSON file is not actually run until the Dagger method is called
in the environment. When we generate the tool we attach our emitters
to the native builders for object/libraries.
"""
Reported by Pylint.
Line: 79
Column: 18
if running_os.startswith("win") or running_os.startswith("sun"):
logging.error("Dagger is only supported on OSX and Linux")
return
result = env.__OBJ_DATABASE(target=target, source=[])
env.AlwaysBuild(result)
env.NoCache(result)
return result
Reported by Pylint.
Line: 88
Column: 12
env.AddMethod(Dagger, "Dagger")
def exists(env):
return True
Reported by Pylint.
Line: 63
Column: 9
]
for suffix in suffixes:
for i in range(len(obj_builders)):
obj_builders[i].add_emitter(
suffix,
SCons.Builder.ListEmitter(
[dagger.emit_obj_db_entry, default_emitters[i]]
),
Reported by Pylint.
Line: 75
Column: 5
action=SCons.Action.Action(dagger.write_obj_db, None)
)
def Dagger(env, target="library_dependency_graph.json"):
if running_os.startswith("win") or running_os.startswith("sun"):
logging.error("Dagger is only supported on OSX and Linux")
return
result = env.__OBJ_DATABASE(target=target, source=[])
env.AlwaysBuild(result)
Reported by Pylint.
Line: 75
Column: 5
action=SCons.Action.Action(dagger.write_obj_db, None)
)
def Dagger(env, target="library_dependency_graph.json"):
if running_os.startswith("win") or running_os.startswith("sun"):
logging.error("Dagger is only supported on OSX and Linux")
return
result = env.__OBJ_DATABASE(target=target, source=[])
env.AlwaysBuild(result)
Reported by Pylint.
Line: 88
Column: 1
env.AddMethod(Dagger, "Dagger")
def exists(env):
return True
Reported by Pylint.
src/third_party/gperftools/dist/src/debugallocation.cc
9 issues
Line: 1154
} debug_malloc_implementation_space;
REGISTER_MODULE_INITIALIZER(debugallocation, {
#if (__cplusplus >= 201103L)
static_assert(alignof(decltype(debug_malloc_implementation_space)) >= alignof(DebugMallocImplementation),
"DebugMallocImplementation is expected to need just word alignment");
#endif
// Either we or valgrind will control memory management. We
// register our extension if we're the winner. Otherwise let
Reported by Cppcheck.
Line: 966
Column: 23
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
static int TraceFd() {
static int trace_fd = -1;
if (trace_fd == -1) { // Open the trace file on the first call
const char *val = getenv("TCMALLOC_TRACE_FILE");
bool fallback_to_stderr = false;
if (!val) {
val = "/tmp/google.alloc";
fallback_to_stderr = true;
}
Reported by FlawFinder.
Line: 280
Column: 19
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 const size_t kMagicMMap = 0xABCDEFAB;
// This array will be filled with 0xCD, for use with memcmp.
static unsigned char kMagicDeletedBuffer[1024];
static pthread_once_t deleted_buffer_initialized_;
static bool deleted_buffer_initialized_no_pthreads_;
private: // data layout
Reported by FlawFinder.
Line: 698
Column: 32
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
// We don't want to allocate or deallocate memory here, so we use
// placement-new. It's ok that we don't destroy this, since we're
// just going to error-exit below anyway. Union is for alignment.
union { void* alignment; char buf[sizeof(SymbolTable)]; } tablebuf;
SymbolTable* symbolization_table = new (tablebuf.buf) SymbolTable;
for (int i = 0; i < queue_entry.num_deleter_pcs; i++) {
// Symbolizes the previous address of pc because pc may be in the
// next function. This may happen when the function ends with
// a call to a function annotated noreturn (e.g. CHECK).
Reported by FlawFinder.
Line: 885
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
// manager thread in linuxthreads has a very small stack,
// so fprintf can't be called.)
static void TracePrintf(int fd, const char *fmt, ...) {
char buf[64];
int i = 0;
va_list ap;
va_start(ap, fmt);
const char *p = fmt;
char numbuf[25];
Reported by FlawFinder.
Line: 890
Column: 3
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
va_list ap;
va_start(ap, fmt);
const char *p = fmt;
char numbuf[25];
if (fd < 0) {
va_end(ap);
return;
}
numbuf[sizeof(numbuf)-1] = 0;
Reported by FlawFinder.
Line: 972
Column: 16
CWE codes:
362
val = "/tmp/google.alloc";
fallback_to_stderr = true;
}
trace_fd = open(val, O_CREAT|O_TRUNC|O_WRONLY, 0666);
if (trace_fd == -1) {
if (fallback_to_stderr) {
trace_fd = 2;
TracePrintf(trace_fd, "Can't open %s. Logging to stderr.\n", val);
} else {
Reported by FlawFinder.
Line: 1149
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 union {
char chars[sizeof(DebugMallocImplementation)];
void *ptr;
} debug_malloc_implementation_space;
REGISTER_MODULE_INITIALIZER(debugallocation, {
#if (__cplusplus >= 201103L)
Reported by FlawFinder.
Line: 1311
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
size_t old_size = (size_t)old_ssize;
CHECK_CONDITION(old_size <= old->data_size());
memcpy(p->data_addr(), ptr, (old_size < size) ? old_size : size);
MallocHook::InvokeDeleteHook(ptr);
MallocHook::InvokeNewHook(p->data_addr(), size);
DebugDeallocate(ptr, MallocBlock::kMallocType, 0);
MALLOC_TRACE("realloc", p->data_size(), p->data_addr());
return p->data_addr();
Reported by FlawFinder.
src/third_party/gperftools/dist/src/base/linux_syscall_support.h
9 issues
Line: 209
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
long long d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
};
/* include/linux/dirent.h */
struct kernel_dirent {
long d_ino;
Reported by FlawFinder.
Line: 217
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
long d_ino;
long d_off;
unsigned short d_reclen;
char d_name[256];
};
/* include/linux/time.h */
struct kernel_timespec {
long tv_sec;
Reported by FlawFinder.
Line: 362
Column: 12
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
#else
struct kernel_stat64 {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned __st_ino;
unsigned st_mode;
unsigned st_nlink;
unsigned st_uid;
unsigned st_gid;
Reported by FlawFinder.
Line: 369
Column: 12
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
unsigned st_uid;
unsigned st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned st_blksize;
unsigned long long st_blocks;
unsigned st_atime_;
unsigned st_atime_nsec_;
Reported by FlawFinder.
Line: 2721
Column: 29
CWE codes:
362
#endif
#ifdef __NR_openat
LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m)
LSS_INLINE int LSS_NAME(open)(const char* p, int f, int m) {
return LSS_NAME(openat)(AT_FDCWD,p,f,m );
}
#else
LSS_INLINE _syscall3(int, open, const char*, p,
int, f, int, m)
Reported by FlawFinder.
Line: 2725
Column: 33
CWE codes:
362
return LSS_NAME(openat)(AT_FDCWD,p,f,m );
}
#else
LSS_INLINE _syscall3(int, open, const char*, p,
int, f, int, m)
#endif
LSS_INLINE int LSS_NAME(sigemptyset)(struct kernel_sigset_t *set) {
memset(&set->sig, 0, sizeof(set->sig));
return 0;
Reported by FlawFinder.
Line: 2846
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
rc = LSS_NAME(_sigaction)(signum, ptr_a, ptr_oa);
if (rc == 0 && oldact) {
if (act) {
memcpy(oldact, act, sizeof(*act));
} else {
memset(oldact, 0, sizeof(*oldact));
}
oldact->sa_handler_ = ptr_oa->sa_handler_;
oldact->sa_flags = ptr_oa->sa_flags;
Reported by FlawFinder.
Line: 2852
Column: 11
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
oldact->sa_handler_ = ptr_oa->sa_handler_;
oldact->sa_flags = ptr_oa->sa_flags;
memcpy(&oldact->sa_mask, &ptr_oa->sa_mask, sizeof(ptr_oa->sa_mask));
#ifndef __mips__
oldact->sa_restorer = ptr_oa->sa_restorer;
#endif
}
}
Reported by FlawFinder.
Line: 2633
Column: 33
CWE codes:
120
20
long, a)
LSS_INLINE _syscall4(long, ptrace, int, r,
pid_t, p, void *, a, void *, d)
LSS_INLINE _syscall3(ssize_t, read, int, f,
void *, b, size_t, c)
LSS_INLINE _syscall4(int, rt_sigaction, int, s,
const struct kernel_sigaction*, a,
struct kernel_sigaction*, o, size_t, c)
LSS_INLINE _syscall4(int, rt_sigprocmask, int, h,
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_checkpoint06.py
9 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import time
import wiredtiger, wttest
# test_checkpoint06.py
# Verify that we rollback the truncation that is committed after stable
# timestamp in the checkpoint.
class test_checkpoint06(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 time
import wiredtiger, wttest
# test_checkpoint06.py
# Verify that we rollback the truncation that is committed after stable
# timestamp in the checkpoint.
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import time
import wiredtiger, wttest
# test_checkpoint06.py
# Verify that we rollback the truncation that is committed after stable
# timestamp in the checkpoint.
class test_checkpoint06(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 40
Column: 9
session_config = 'isolation=snapshot'
def test_rollback_truncation_in_checkpoint(self):
self.uri = 'table:ckpt06'
self.session.create(self.uri, 'key_format=i,value_format=S')
value = "abcdefghijklmnopqrstuvwxyz" * 3
self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(1))
cursor = self.session.open_cursor(self.uri)
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import time
import wiredtiger, wttest
# test_checkpoint06.py
# Verify that we rollback the truncation that is committed after stable
# timestamp in the checkpoint.
class test_checkpoint06(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 35
Column: 1
# test_checkpoint06.py
# Verify that we rollback the truncation that is committed after stable
# timestamp in the checkpoint.
class test_checkpoint06(wttest.WiredTigerTestCase):
conn_config = 'create,cache_size=50MB'
session_config = 'isolation=snapshot'
def test_rollback_truncation_in_checkpoint(self):
self.uri = 'table:ckpt06'
Reported by Pylint.
Line: 35
Column: 1
# test_checkpoint06.py
# Verify that we rollback the truncation that is committed after stable
# timestamp in the checkpoint.
class test_checkpoint06(wttest.WiredTigerTestCase):
conn_config = 'create,cache_size=50MB'
session_config = 'isolation=snapshot'
def test_rollback_truncation_in_checkpoint(self):
self.uri = 'table:ckpt06'
Reported by Pylint.
Line: 39
Column: 5
conn_config = 'create,cache_size=50MB'
session_config = 'isolation=snapshot'
def test_rollback_truncation_in_checkpoint(self):
self.uri = 'table:ckpt06'
self.session.create(self.uri, 'key_format=i,value_format=S')
value = "abcdefghijklmnopqrstuvwxyz" * 3
self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(1))
Reported by Pylint.