Skip to content

Commit eaad100

Browse files
Comment on the bound for overflow in int to string conversion
An overflow can happen when reaching the last index of a string of maximal size which is max_size for negative numbers and max_size - 1 for positive numbers because of the abscence of a `-` (minus) sign
1 parent fb3ab81 commit eaad100

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/solvers/refinement/string_constraint_generator_valueof.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ string_exprt string_constraint_generatort::add_axioms_from_int(
297297
binary_relation_exprt(res[j], ID_le, nine_char));
298298
digit_constraints.push_back(is_number);
299299

300+
// An overflow can happen when reaching the last index of a string of
301+
// maximal size which is `max_size` for negative numbers and
302+
// `max_size - 1` for positive numbers because of the abscence of a `-`
303+
// sign.
300304
if(j>=max_size-2)
301305
{
302306
// check for overflows if the size is big

0 commit comments

Comments
 (0)