-
Notifications
You must be signed in to change notification settings - Fork 274
fix exprt::opX accesses in java_bytecode #5018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, I don't see that we're improving anything by using an unchecked cast to multi_ary_exprt
and then using the similarly unguarded op0
etc though, I think we should introduce appropriate containers for these
@@ -916,8 +916,9 @@ void add_java_array_types(symbol_tablet &symbol_table) | |||
|
|||
side_effect_exprt inc(ID_assign, typet(), location); | |||
inc.operands().resize(2); | |||
inc.op0()=index_symexpr; | |||
inc.op1()=plus_exprt(index_symexpr, from_integer(1, index_symexpr.type())); | |||
to_binary_expr(inc).op0() = index_symexpr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's introduce side_effect_expr_assignt
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -494,20 +493,23 @@ optionalt<codet> java_bytecode_instrumentt::instrument_expr(const exprt &expr) | |||
{ | |||
// this corresponds to a throw and so we check that | |||
// we don't throw null | |||
result.add(check_null_dereference(expr.op0(), expr.source_location())); | |||
result.add(check_null_dereference( | |||
to_unary_expr(expr).op(), expr.source_location())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have side_effect_expr_throwt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but that doesn't have operands -- will make that a separate PR.
} | ||
else if(statement==ID_java_new_array) | ||
{ | ||
// this corresponds to new array so we check that | ||
// length is >=0 | ||
result.add(check_array_length(expr.op0(), expr.source_location())); | ||
result.add(check_array_length( | ||
to_multi_ary_expr(expr).op0(), expr.source_location())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a container for java_new_array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: d85e24f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123241525
This improves type safety.
d85e24f
to
185a3c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 185a3c3).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123355159
This improves type safety.