@@ -942,10 +942,10 @@ void ebpf_transformer::forget_packet_pointers() {
942
942
dom.initialize_packet ();
943
943
}
944
944
945
- static void overflow_bounds (NumAbsDomain& inv, variable_t lhs, number_t span, int finite_width, bool issigned) {
945
+ static void overflow_bounds (NumAbsDomain& inv, variable_t lhs, int finite_width, bool issigned) {
946
946
using namespace crab ::dsl_syntax;
947
947
auto interval = inv[lhs];
948
- if (interval.ub () - interval. lb () >= span ) {
948
+ if (interval.size () >= interval_t::unsigned_int (finite_width). size () ) {
949
949
// Interval covers the full space.
950
950
inv -= lhs;
951
951
return ;
@@ -980,21 +980,11 @@ static void overflow_bounds(NumAbsDomain& inv, variable_t lhs, number_t span, in
980
980
}
981
981
982
982
static void overflow_signed (NumAbsDomain& inv, const variable_t lhs, const int finite_width) {
983
- const auto span{finite_width == 64 ? number_t {std::numeric_limits<uint64_t >::max ()}
984
- : finite_width == 32 ? number_t {std::numeric_limits<uint32_t >::max ()}
985
- : finite_width == 16 ? number_t {std::numeric_limits<uint16_t >::max ()}
986
- : finite_width == 8 ? number_t {std::numeric_limits<uint8_t >::max ()}
987
- : throw std::exception ()};
988
- overflow_bounds (inv, lhs, span, finite_width, true );
983
+ overflow_bounds (inv, lhs, finite_width, true );
989
984
}
990
985
991
986
static void overflow_unsigned (NumAbsDomain& inv, const variable_t lhs, const int finite_width) {
992
- const auto span{finite_width == 64 ? number_t {std::numeric_limits<uint64_t >::max ()}
993
- : finite_width == 32 ? number_t {std::numeric_limits<uint32_t >::max ()}
994
- : finite_width == 16 ? number_t {std::numeric_limits<uint16_t >::max ()}
995
- : finite_width == 8 ? number_t {std::numeric_limits<uint8_t >::max ()}
996
- : throw std::exception ()};
997
- overflow_bounds (inv, lhs, span, finite_width, false );
987
+ overflow_bounds (inv, lhs, finite_width, false );
998
988
}
999
989
static void apply_signed (NumAbsDomain& inv, const binop_t & op, const variable_t xs, const variable_t xu,
1000
990
const variable_t y, const number_t & z, const int finite_width) {
@@ -1550,13 +1540,11 @@ void ebpf_transformer::do_store_stack(NumAbsDomain& inv, const linear_expression
1550
1540
} else {
1551
1541
if ((width == 1 || width == 2 || width == 4 ) && type_inv.get_type (m_inv, val_type) == T_NUM) {
1552
1542
// Keep track of numbers on the stack that might be used as array indices.
1553
- auto stack_svalue = stack.store (inv, data_kind_t ::svalues, addr, width, val_svalue);
1554
- auto stack_uvalue = stack.store (inv, data_kind_t ::uvalues, addr, width, val_uvalue);
1555
- if (stack_svalue.has_value ()) {
1543
+ if (const auto stack_svalue = stack.store (inv, data_kind_t ::svalues, addr, width, val_svalue)) {
1556
1544
inv.assign (stack_svalue, val_svalue);
1557
1545
overflow_signed (inv, *stack_svalue, width * 8 );
1558
1546
}
1559
- if (stack_uvalue. has_value ( )) {
1547
+ if (const auto stack_uvalue = stack. store (inv, data_kind_t ::uvalues, addr, width, val_uvalue )) {
1560
1548
inv.assign (stack_uvalue, val_uvalue);
1561
1549
overflow_unsigned (inv, *stack_uvalue, width * 8 );
1562
1550
}
0 commit comments