The following issues were found
src/third_party/abseil-cpp-master/abseil-cpp/absl/flags/internal/sequence_lock.h
3 issues
Line: 148
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
char* dst_byte = static_cast<char*>(dst);
while (size >= sizeof(uint64_t)) {
uint64_t word = src->load(std::memory_order_relaxed);
std::memcpy(dst_byte, &word, sizeof(word));
dst_byte += sizeof(word);
src++;
size -= sizeof(word);
}
if (size > 0) {
Reported by FlawFinder.
Line: 155
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
if (size > 0) {
uint64_t word = src->load(std::memory_order_relaxed);
std::memcpy(dst_byte, &word, size);
}
}
// Perform the equivalent of "memcpy(dst, src, size)", but using relaxed
// atomics.
Reported by FlawFinder.
Line: 174
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
if (size > 0) {
uint64_t word = 0;
std::memcpy(&word, src_byte, size);
dst->store(word, std::memory_order_relaxed);
}
}
static constexpr int64_t kUninitialized = -1;
Reported by FlawFinder.
src/mongo/bson/oid.h
3 issues
Line: 95
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/** init from a reference to a 12-byte array */
explicit OID(const unsigned char (&arr)[kOIDSize]) {
std::memcpy(_data, arr, sizeof(arr));
}
/** initialize to 'null' */
void clear() {
std::memset(_data, 0, kOIDSize);
Reported by FlawFinder.
Line: 133
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
template <typename T>
static OID from(T* buf) {
OID o((no_initialize_tag()));
std::memcpy(o._data, buf, OID::kOIDSize);
return o;
}
static OID max() {
OID o((no_initialize_tag()));
Reported by FlawFinder.
Line: 243
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
struct no_initialize_tag {};
explicit OID(no_initialize_tag) {}
char _data[kOIDSize];
};
inline std::ostream& operator<<(std::ostream& s, const OID& o) {
return (s << o.toString());
}
Reported by FlawFinder.
src/mongo/db/exec/sbe/stages/hash_join.cpp
3 issues
Line: 131
Column: 21
CWE codes:
362
return ctx.getAccessor(slot);
}
void HashJoinStage::open(bool reOpen) {
auto optTimer(getOptTimer(_opCtx));
if (_collatorAccessor) {
auto [tag, collatorVal] = _collatorAccessor->getViewOfValue();
uassert(5402504, "collatorSlot must be of collator type", tag == value::TypeTags::collator);
Reported by FlawFinder.
Line: 146
Column: 19
CWE codes:
362
}
_commonStats.opens++;
_children[0]->open(reOpen);
// Insert the outer side into the hash table.
while (_children[0]->getNext() == PlanState::ADVANCED) {
value::MaterializedRow key{_inOuterKeyAccessors.size()};
value::MaterializedRow project{_inOuterProjectAccessors.size()};
Reported by FlawFinder.
Line: 171
Column: 19
CWE codes:
362
_children[0]->close();
_children[1]->open(reOpen);
_htIt = _ht->end();
_htItEnd = _ht->end();
}
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/gas.py
3 issues
Line: 38
Column: 1
try:
as_module = __import__('as', globals(), locals(), [])
except:
as_module = __import__(__package__+'.as', globals(), locals(), ['*'])
assemblers = ['as', 'gas']
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/gas.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
try:
as_module = __import__('as', globals(), locals(), [])
except:
as_module = __import__(__package__+'.as', globals(), locals(), ['*'])
Reported by Pylint.
Line: 49
Column: 1
env['AS'] = env.Detect(assemblers) or 'as'
def exists(env):
return env.Detect(assemblers)
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/debugging/failure_signal_handler.cc
3 issues
Line: 225
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 void WriteSignalMessage(int signo, int cpu,
void (*writerfn)(const char*)) {
char buf[96];
char on_cpu[32] = {0};
if (cpu != -1) {
snprintf(on_cpu, sizeof(on_cpu), " on cpu %d", cpu);
}
const char* const signal_string =
Reported by FlawFinder.
Line: 226
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 void WriteSignalMessage(int signo, int cpu,
void (*writerfn)(const char*)) {
char buf[96];
char on_cpu[32] = {0};
if (cpu != -1) {
snprintf(on_cpu, sizeof(on_cpu), " on cpu %d", cpu);
}
const char* const signal_string =
debugging_internal::FailureSignalToString(signo);
Reported by FlawFinder.
Line: 220
Column: 55
CWE codes:
126
static void WriteToStderr(const char* data) {
absl::base_internal::ErrnoSaver errno_saver;
absl::raw_logging_internal::SafeWriteToStderr(data, strlen(data));
}
static void WriteSignalMessage(int signo, int cpu,
void (*writerfn)(const char*)) {
char buf[96];
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/clangCommon/__init__.py
3 issues
Line: 13
Column: 1
r'C:\msys',
]
def get_clang_install_dirs(platform):
if platform == 'win32':
return clang_win32_dirs
else:
return []
Reported by Pylint.
Line: 14
Column: 5
]
def get_clang_install_dirs(platform):
if platform == 'win32':
return clang_win32_dirs
else:
return []
Reported by Pylint.
Line: 17
Column: 1
if platform == 'win32':
return clang_win32_dirs
else:
return []
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/container/internal/container_memory_test.cc
3 issues
Line: 40
using ::testing::Gt;
using ::testing::Pair;
TEST(Memory, AlignmentLargerThanBase) {
std::allocator<int8_t> alloc;
void* mem = Allocate<2>(&alloc, 3);
EXPECT_EQ(0, reinterpret_cast<uintptr_t>(mem) % 2);
memcpy(mem, "abc", 3);
Deallocate<2>(&alloc, mem, 3);
Reported by Cppcheck.
Line: 44
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
std::allocator<int8_t> alloc;
void* mem = Allocate<2>(&alloc, 3);
EXPECT_EQ(0, reinterpret_cast<uintptr_t>(mem) % 2);
memcpy(mem, "abc", 3);
Deallocate<2>(&alloc, mem, 3);
}
TEST(Memory, AlignmentSmallerThanBase) {
std::allocator<int64_t> alloc;
Reported by FlawFinder.
Line: 52
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
std::allocator<int64_t> alloc;
void* mem = Allocate<2>(&alloc, 3);
EXPECT_EQ(0, reinterpret_cast<uintptr_t>(mem) % 2);
memcpy(mem, "abc", 3);
Deallocate<2>(&alloc, mem, 3);
}
std::map<std::type_index, int>& AllocationMap() {
static auto* map = new std::map<std::type_index, int>;
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/386asm.py
3 issues
Line: 1
Column: 1
"""SCons.Tool.386asm
Tool specification for the 386ASM assembler for the Phar Lap ETS embedded
operating system.
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: 35
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/386asm.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
from SCons.Tool.PharLapCommon import addPharLapPaths
import SCons.Util
as_module = __import__('as', globals(), locals(), [], 1)
Reported by Pylint.
Line: 54
Column: 1
addPharLapPaths(env)
def exists(env):
return env.Detect('386asm')
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/container/btree_test.h
3 issues
Line: 64
Column: 29
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 char* GenerateDigits(char buf[16], unsigned val, unsigned maxval) {
assert(val <= maxval);
constexpr unsigned kBase = 64; // avoid integer division.
unsigned p = 15;
buf[p--] = 0;
while (maxval > 0) {
Reported by FlawFinder.
Line: 99
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int maxval;
explicit Generator(int m) : maxval(m) {}
std::string operator()(int i) const {
char buf[16];
return GenerateDigits(buf, i, maxval);
}
};
template <>
Reported by FlawFinder.
Line: 109
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int maxval;
explicit Generator(int m) : maxval(m) {}
Cord operator()(int i) const {
char buf[16];
return Cord(GenerateDigits(buf, i, maxval));
}
};
template <typename T, typename U>
Reported by FlawFinder.
src/mongo/db/exec/sbe/stages/bson_scan.cpp
3 issues
Line: 84
Column: 21
CWE codes:
362
return ctx.getAccessor(slot);
}
void BSONScanStage::open(bool reOpen) {
auto optTimer(getOptTimer(_opCtx));
_commonStats.opens++;
_bsonCurrent = _bsonBegin;
}
Reported by FlawFinder.
Line: 102
Column: 47
CWE codes:
120
20
if (auto fieldsToMatch = _fieldAccessors.size(); fieldsToMatch != 0) {
auto be = _bsonCurrent;
auto end = be + ConstDataView(be).read<LittleEndian<uint32_t>>();
// Skip document length.
be += 4;
for (auto& [name, accessor] : _fieldAccessors) {
accessor->reset();
}
Reported by FlawFinder.
Line: 127
Column: 53
CWE codes:
120
20
}
// Advance to the next document.
_bsonCurrent += ConstDataView(_bsonCurrent).read<LittleEndian<uint32_t>>();
_specificStats.numReads++;
return trackPlanState(PlanState::ADVANCED);
}
Reported by FlawFinder.