The following issues were found
c10/test/util/TypeList_test.cpp
1 issues
Line: 214
}
};
TEST(TypeListTest, MapTypesToValues_sametype) {
auto sizes =
map_types_to_values<typelist<int64_t, bool, uint32_t>>(map_to_size());
std::tuple<size_t, size_t, size_t> expected(8, 1, 4);
static_assert(std::is_same<decltype(expected), decltype(sizes)>::value, "");
EXPECT_EQ(expected, sizes);
Reported by Cppcheck.
c10/test/util/ThreadLocal_test.cpp
1 issues
Line: 13
C10_DEFINE_TLS_static(std::string, str);
}
TEST(ThreadLocalTest, TestNoOpScopeWithTwoVars) {
C10_DEFINE_TLS_static(std::string, str);
C10_DEFINE_TLS_static(std::string, str2);
}
TEST(ThreadLocalTest, TestScopeWithOneVar) {
Reported by Cppcheck.
c10/test/util/Half_test.cpp
1 issues
Line: 96
return (sign | (exponent << 10) | mantissa);
};
} // namespace half_legacy_impl
TEST(HalfDoubleConversionTest, Half2Double) {
std::vector<uint16_t> inputs = {
0,
0xfbff, // 1111 1011 1111 1111
(1 << 15 | 1),
0x7bff // 0111 1011 1111 1111
Reported by Cppcheck.
c10/test/util/C++17_test.cpp
1 issues
Line: 26
using c10::guts::if_constexpr;
TEST(if_constexpr, whenIsTrue_thenReturnsTrueCase) {
EXPECT_EQ(
4, if_constexpr<true>([](auto) { return 4; }, [](auto) { return 5; }));
}
TEST(if_constexpr, whenIsFalse_thenReturnsFalseCase) {
Reported by Cppcheck.
c10/test/core/CompileTimeFunctionPointer_test.cpp
1 issues
Line: 55
}
};
TEST(CompileTimeFunctionPointerTest, runFunctionThroughType) {
Executor<Add> executor;
EXPECT_EQ(3, executor.execute(1, 2));
}
} // namespace test_run_through_type
Reported by Cppcheck.
c10/core/impl/SizesAndStrides.h
1 issues
Line: 292
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
void copyDataOutline(const SizesAndStrides& rhs) noexcept {
memcpy(outOfLineStorage_, rhs.outOfLineStorage_, storageBytes(rhs.size_));
}
size_t size_;
union {
int64_t* outOfLineStorage_;
Reported by FlawFinder.
binaries/parallel_info.cc
1 issues
Line: 37
Column: 8
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
cmd << "lsof -p " << getpid() << " | grep .so";
std::cout << "Loaded .so:" << std::endl;
std::cout << cmd.str() << std::endl;
std::system(cmd.str().c_str());
# endif
return 0;
}
Reported by FlawFinder.
binaries/make_image_db.cc
1 issues
Line: 245
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
}
constexpr auto key_max_length = 256;
char key_cstr[key_max_length];
int count = 0;
for (auto i = 0; i < lines.size(); i++) {
// Get serialized proto for this entry
auto value = converters[i % converters.size()].get();
Reported by FlawFinder.
benchmarks/sparse/dlmc/__init__.py
1 issues
Line: 1
Column: 1
if __name__ == "__main__":
pass
Reported by Pylint.
benchmarks/sparse/__init__.py
1 issues
Line: 1
Column: 1
if __name__ == "__main__":
pass
Reported by Pylint.