Skip to content

Commit 985684a

Browse files
Prevent overflow with argument of lastIndexOf
1 parent 04766b2 commit 985684a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/solvers/refinement/string_constraint_generator_indexof.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ exprt string_constraint_generatort::add_axioms_for_last_index_of(
348348
axioms.push_back(a3);
349349

350350
const exprt index1 = from_integer(1, index_type);
351-
const plus_exprt from_index_plus_one(from_index, index1);
351+
const exprt from_index_plus_one =
352+
plus_exprt_with_overflow_check(from_index, index1);
352353
const if_exprt end_index(
353354
binary_relation_exprt(from_index_plus_one, ID_le, str.length()),
354355
from_index_plus_one,

0 commit comments

Comments
 (0)