mirror of
https://github.com/Z3Prover/z3
synced 2026-03-16 18:20:00 +00:00
Fix static analysis findings: uninitialized vars, bitwise shift UB, garbage values
- nla_core.cpp: Initialize j = null_lpvar in is_octagon_term - bit2int.cpp: Initialize sign_p, sign_n, sz_p, sz_n - act_cache.cpp: Initialize debug vars to nullptr - enum2bv_rewriter.cpp: Use unsigned literal in 1u << idx - bit_matrix.cpp: Use unsigned literal in 1u << (n-1) - bit_util.cpp: Guard against bit_shift == 0 in shl/shr - mpff.cpp: Cast exp to unsigned before shifting - sorting_network.h: Guard against bits == 0 - dl_sparse_table.h: Use >= 64 instead of == 64 Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
122ee94935
commit
8e94cad8ab
9 changed files with 42 additions and 22 deletions
|
|
@ -161,7 +161,7 @@ uint64_t mpff_manager::get_uint64(mpff const & a) const {
|
|||
int exp = -a.m_exponent - sizeof(unsigned) * 8 * (m_precision - 2);
|
||||
SASSERT(exp >= 0);
|
||||
uint64_t * s = reinterpret_cast<uint64_t*>(sig(a) + (m_precision - 2));
|
||||
return *s >> exp;
|
||||
return *s >> static_cast<unsigned>(exp);
|
||||
}
|
||||
|
||||
int64_t mpff_manager::get_int64(mpff const & a) const {
|
||||
|
|
@ -175,7 +175,7 @@ int64_t mpff_manager::get_int64(mpff const & a) const {
|
|||
return INT64_MIN;
|
||||
}
|
||||
else {
|
||||
int64_t r = *s >> exp;
|
||||
int64_t r = *s >> static_cast<unsigned>(exp);
|
||||
if (is_neg(a))
|
||||
r = -r;
|
||||
return r;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue