The following issues were found
aten/src/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h
2 issues
Line: 152
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
__at_align__ double tmp_values[size()];
std::memcpy(tmp_values, ptr, std::min(count, size()) * sizeof(value_type));
return {
(vint64)vec_vsx_ld(offset0, tmp_values),
(vint64)vec_vsx_ld(offset16, tmp_values)};
}
Reported by FlawFinder.
Line: 167
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
__at_align__ double tmp_values[size()];
vec_vsx_st((vfloat64)_vec0, offset0, tmp_values);
vec_vsx_st((vfloat64)_vec1, offset16, tmp_values);
std::memcpy(
ptr, tmp_values, std::min(count, size()) * sizeof(value_type));
}
}
const int64_t& operator[](int idx) const = delete;
int64_t& operator[](int idx) = delete;
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec256/vsx/vec256_qint32_vsx.h
2 issues
Line: 85
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
__at_align__ value_type tmp_values[size()];
std::memcpy(tmp_values, ptr, std::min(count, size()) * sizeof(value_type));
return {vec_vsx_ld(offset0, tmp_values), vec_vsx_ld(offset16, tmp_values)};
}
void C10_ALWAYS_INLINE store(void* ptr, int count = size()) const {
if (count == size()) {
Reported by FlawFinder.
Line: 97
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
__at_align__ value_type tmp_values[size()];
vec_vsx_st(_vec0, offset0, tmp_values);
vec_vsx_st(_vec1, offset16, tmp_values);
std::memcpy(
ptr, tmp_values, std::min(count, size()) * sizeof(value_type));
}
}
C10_ALWAYS_INLINE const vec_internal_type& vec0() const {
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec256/vsx/vec256_qint8_vsx.h
2 issues
Line: 95
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
vec_vsx_ld(offset16, reinterpret_cast<const vint8*>(ptr))};
}
__at_align__ value_type tmp_values[size()];
std::memcpy(tmp_values, ptr, std::min(count, size()) * sizeof(value_type));
return {vec_vsx_ld(offset0, tmp_values), vec_vsx_ld(offset16, tmp_values)};
}
void C10_ALWAYS_INLINE store(void* ptr, int count = size()) const {
if (count == size()) {
vec_vsx_st(_vec0, offset0, reinterpret_cast<value_type*>(ptr));
Reported by FlawFinder.
Line: 106
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
__at_align__ value_type tmp_values[size()];
vec_vsx_st(_vec0, offset0, tmp_values);
vec_vsx_st(_vec1, offset16, tmp_values);
std::memcpy(
ptr, tmp_values, std::min(count, size()) * sizeof(value_type));
}
}
public:
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec256/vsx/vec256_quint8_vsx.h
2 issues
Line: 96
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
vec_vsx_ld(offset16, reinterpret_cast<const value_type*>(ptr))};
}
__at_align__ value_type tmp_values[size()];
std::memcpy(tmp_values, ptr, std::min(count, size()) * sizeof(value_type));
return {vec_vsx_ld(offset0, tmp_values), vec_vsx_ld(offset16, tmp_values)};
}
void C10_ALWAYS_INLINE store(void* ptr, int count = size()) const {
if (count == size()) {
vec_vsx_st(_vec0, offset0, reinterpret_cast<value_type*>(ptr));
Reported by FlawFinder.
Line: 107
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
__at_align__ value_type tmp_values[size()];
vec_vsx_st(_vec0, offset0, tmp_values);
vec_vsx_st(_vec1, offset16, tmp_values);
std::memcpy(
ptr, tmp_values, std::min(count, size()) * sizeof(value_type));
}
}
public:
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec512/vec512_bfloat16.h
2 issues
Line: 112
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
static Vectorized<BFloat16> loadu(const void* ptr, int16_t count) {
__at_align__ int16_t tmp_values[size()];
std::memcpy(tmp_values, ptr, count * sizeof(int16_t));
return loadu(tmp_values);
}
void store(void* ptr, int count = size()) const {
if (count == size()) {
_mm512_storeu_si512(reinterpret_cast<__m512i*>(ptr), values);
Reported by FlawFinder.
Line: 121
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
} else if (count > 0) {
__at_align__ int16_t tmp_values[size()];
_mm512_storeu_si512(reinterpret_cast<__m512i*>(tmp_values), values);
std::memcpy(ptr, tmp_values, count * sizeof(int16_t));
}
}
template <int64_t mask>
static Vectorized<BFloat16> blend(const Vectorized<BFloat16>& a, const Vectorized<BFloat16>& b) {
__at_align__ int16_t tmp_values[size()];
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec512/vec512_complex_double.h
2 issues
Line: 132
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
for (auto i = 0; i < 2*size(); ++i) {
tmp_values[i] = 0.0;
}
std::memcpy(
tmp_values,
reinterpret_cast<const double*>(ptr),
count * sizeof(c10::complex<double>));
return _mm512_load_pd(tmp_values);
}
Reported by FlawFinder.
Line: 144
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
} else if (count > 0) {
double tmp_values[2*size()];
_mm512_storeu_pd(reinterpret_cast<double*>(tmp_values), values);
std::memcpy(ptr, tmp_values, count * sizeof(c10::complex<double>));
}
}
const c10::complex<double>& operator[](int idx) const = delete;
c10::complex<double>& operator[](int idx) = delete;
Vectorized<c10::complex<double>> map(c10::complex<double> (*const f)(const c10::complex<double> &)) const {
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec512/vec512_complex_float.h
2 issues
Line: 636
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
for (auto i = 0; i < 2*size(); ++i) {
tmp_values[i] = 0.0;
}
std::memcpy(
tmp_values,
reinterpret_cast<const float*>(ptr),
count * sizeof(c10::complex<float>));
return _mm512_load_ps(tmp_values);
}
Reported by FlawFinder.
Line: 648
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
} else if (count > 0) {
float tmp_values[2*size()];
_mm512_storeu_ps(reinterpret_cast<float*>(tmp_values), values);
std::memcpy(ptr, tmp_values, count * sizeof(c10::complex<float>));
}
}
// AVX512 doesn't have horizontal add & horizontal sub instructions.
// TODO: hadd_pd() & hsub_pd() may have scope for improvement.
static inline __m512 hadd_ps(__m512 a, __m512 b) {
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec512/vec512_double.h
2 issues
Line: 93
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
for (auto i = 0; i < size(); ++i) {
tmp_values[i] = 0.0;
}
std::memcpy(
tmp_values,
reinterpret_cast<const double*>(ptr),
count * sizeof(double));
return _mm512_load_pd(tmp_values);
}
Reported by FlawFinder.
Line: 105
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
} else if (count > 0) {
double tmp_values[size()];
_mm512_storeu_pd(reinterpret_cast<double*>(tmp_values), values);
std::memcpy(ptr, tmp_values, count * sizeof(double));
}
}
const double& operator[](int idx) const = delete;
double& operator[](int idx) = delete;
int zero_mask() const {
Reported by FlawFinder.
aten/src/ATen/cpu/vec/vec512/vec512_float.h
2 issues
Line: 110
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
for (auto i = 0; i < size(); ++i) {
tmp_values[i] = 0.0;
}
std::memcpy(
tmp_values, reinterpret_cast<const float*>(ptr), count * sizeof(float));
return _mm512_loadu_ps(tmp_values);
}
void store(void* ptr, int64_t count = size()) const {
if (count == size()) {
Reported by FlawFinder.
Line: 120
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
} else if (count > 0) {
float tmp_values[size()];
_mm512_storeu_ps(reinterpret_cast<float*>(tmp_values), values);
std::memcpy(ptr, tmp_values, count * sizeof(float));
}
}
const float& operator[](int idx) const = delete;
float& operator[](int idx) = delete;
int zero_mask() const {
Reported by FlawFinder.
aten/src/ATen/native/Copy.cpp
2 issues
Line: 65
Column: 11
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// 1. copy columns from src to buf
for (int c = 0; c < nc; c++) {
memcpy(bp + c * BLOCK_SZ, spo + c * NR, nr * sizeof(scalar_t));
}
// 2. transpose buf in place
int rc_max = std::max(nr, nc);
int rc_min = std::min(nr, nc);
Reported by FlawFinder.
Line: 82
Column: 11
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// 3. copy rows from buf to dst
for (int r = 0; r < nr; r++) {
memcpy(rpo + r * NC, bp + r * BLOCK_SZ, nc * sizeof(scalar_t));
}
}
}
});
}
Reported by FlawFinder.