uninitialized.UndefReturn

This commit is contained in:
gtsoul-tech 2024-05-29 11:51:06 +03:00
parent d23e4a12e7
commit faa9e7549f
2 changed files with 6 additions and 0 deletions

View File

@ -796,6 +796,9 @@ public:
explicit prop_map(value_type P_of::*m_in) : member(m_in) { }
reference operator[](key_type k) const {
if (k.raw() == nullptr || &(k.raw()->props) == nullptr) {
throw std::invalid_argument("Invalid key");
}
return k.raw()->props.*member;
}
reference operator()(key_type k) const { return (*this)[k]; }

View File

@ -58,6 +58,9 @@ u32 unaligned_load_u32(const void *ptr) {
/// Perform an unaligned 64-bit load
static really_inline
u64a unaligned_load_u64a(const void *ptr) {
if (ptr == NULL) {
return 0; // Return a default value
}
struct unaligned { u64a u; } PACKED__MAY_ALIAS;
// cppcheck-suppress cstyleCast
const struct unaligned *uptr = (const struct unaligned *)ptr;