The following issues were found
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/fastmath_test.cc
1 issues
Line: 56
}
}
TEST(FastMathTest, IntLog2CeilTest) {
using absl::random_internal::IntLog2Ceil;
constexpr uint64_t kZero = 0;
EXPECT_EQ(0, IntLog2Ceil(0)); // boundary. return 0.
EXPECT_EQ(0, IntLog2Ceil(1));
EXPECT_EQ(1, IntLog2Ceil(2));
Reported by Cppcheck.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/generate_real.h
1 issues
Line: 137
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// bit_cast to the output-type
real_type result;
memcpy(static_cast<void*>(&result), static_cast<const void*>(&val),
sizeof(result));
return result;
}
} // namespace random_internal
Reported by FlawFinder.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/generate_real_test.cc
1 issues
Line: 47
EXPECT_EQ(ToFloat(0xFFFFFFFFFFFFFFFF), 0.9999999404f);
}
TEST(GenerateRealTest, U64ToFloat_Positive_Zero_Test) {
auto ToFloat = [](uint64_t a) {
return GenerateRealFromBits<float, GeneratePositiveTag, true>(a);
};
EXPECT_EQ(ToFloat(0x0000000000000000), 0.0);
EXPECT_EQ(ToFloat(0x0000000000000001), 5.421010862e-20f);
Reported by Cppcheck.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/iostream_state_saver_test.cc
1 issues
Line: 79
return result;
}
TEST(IOStreamStateSaver, BasicSaverState) {
std::stringstream ss;
ss.precision(2);
ss.fill('x');
ss.flags(std::ios_base::dec | std::ios_base::right);
Reported by Cppcheck.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/pcg_engine_test.cc
1 issues
Line: 42
TYPED_TEST_SUITE(PCGEngineTest, EngineTypes);
TYPED_TEST(PCGEngineTest, VerifyReseedChangesAllValues) {
using engine_type = TypeParam;
using result_type = typename engine_type::result_type;
const size_t kNumOutputs = 16;
engine_type engine;
Reported by Cppcheck.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/pool_urbg.cc
1 issues
Line: 126
Column: 10
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
MaybeRefill();
size_t remaining = (kState - next_) * sizeof(state_[0]);
size_t to_copy = std::min(bytes, remaining);
std::memcpy(out, &state_[next_], to_copy);
out += to_copy;
bytes -= to_copy;
next_ += (to_copy + sizeof(state_[0]) - 1) / sizeof(state_[0]);
}
}
Reported by FlawFinder.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/pool_urbg_test.cc
1 issues
Line: 74
// This test is checks that the engines meet the URBG interface requirements
// defined in [rand.req.urbg].
TYPED_TEST(PoolURBGTypedTest, URBGInterface) {
using E = TypeParam;
using T = typename E::result_type;
static_assert(std::is_copy_constructible<E>::value,
"engine must be copy constructible");
Reported by Cppcheck.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/randen_engine.h
1 issues
Line: 166
Column: 17
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
bool operator==(const randen_engine& other) const {
return next_ == other.next_ &&
std::equal(std::begin(state_), std::end(state_),
std::begin(other.state_));
}
bool operator!=(const randen_engine& other) const {
return !(*this == other);
Reported by FlawFinder.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/randen_hwaes_test.cc
1 issues
Line: 41
uint32_t seed[kSeedSizeT];
};
TEST(RandenHwAesTest, Default) {
EXPECT_TRUE(absl::random_internal::CPUSupportsRandenHwAes());
constexpr uint64_t kGolden[] = {
0x6c6534090ee6d3ee, 0x044e2b9b9d5333c6, 0xc3c14f134e433977,
0xdda9f47cd90410ee, 0x887bf3087fd8ca10, 0xf0b780f545c72912,
Reported by Cppcheck.
src/third_party/abseil-cpp-master/abseil-cpp/absl/random/internal/randen_slow_test.cc
1 issues
Line: 39
uint32_t seed[kSeedSizeT];
};
TEST(RandenSlowTest, Default) {
constexpr uint64_t kGolden[] = {
0x6c6534090ee6d3ee, 0x044e2b9b9d5333c6, 0xc3c14f134e433977,
0xdda9f47cd90410ee, 0x887bf3087fd8ca10, 0xf0b780f545c72912,
0x15dbb1d37696599f, 0x30ec63baff3c6d59, 0xb29f73606f7f20a6,
0x02808a316f49a54c, 0x3b8feaf9d5c8e50e, 0x9cbf605e3fd9de8a,
Reported by Cppcheck.