Skip to content

Commit b9fdfcd

Browse files
committed
Updates requested in the PR:
- rename uncasted_access_path -> uncast_access_path - improved comments and error message. - typos
1 parent 8261c33 commit b9fdfcd

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/taint-slicer/instrumenter.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,20 +392,20 @@ exprt taint_instrumentert::drive_access_path_through_super_classes(
392392
// data types. We resolve the typecast so that we build the struct
393393
// initialiser for the wrapper type and we initialise all members by making
394394
// accesses to the corresponding members in the origin wrapped access path.
395-
exprt uncasted_access_path = access_path;
396-
while(uncasted_access_path.id() == ID_typecast)
397-
uncasted_access_path = to_typecast_expr(uncasted_access_path).op();
398-
uncasted_access_path =
399-
drive_access_path_through_super_classes(uncasted_access_path);
395+
exprt uncast_access_path = access_path;
396+
while(uncast_access_path.id() == ID_typecast)
397+
uncast_access_path = to_typecast_expr(uncast_access_path).op();
398+
uncast_access_path =
399+
drive_access_path_through_super_classes(uncast_access_path);
400400
const typet uncasted_access_path_type =
401-
instrumented_namespace.follow(uncasted_access_path.type());
401+
instrumented_namespace.follow(uncast_access_path.type());
402402
struct_exprt struct_expr(fixed_type);
403403
// First we set the super instance (i.e. '@__CPROVER__super' member,
404404
// which is actually the instance of the primitive type).
405405
struct_expr.operands().push_back(
406406
typecast_exprt(
407407
get_super_if_subclassed(
408-
uncasted_access_path,
408+
uncast_access_path,
409409
get_inverse_type_substitutions(),
410410
get_instrumented_symbol_table()),
411411
access_path.type()));
@@ -427,7 +427,7 @@ exprt taint_instrumentert::drive_access_path_through_super_classes(
427427
)
428428
{
429429
struct_expr.operands().push_back(member_exprt(
430-
uncasted_access_path, component.get_name(), bool_typet()));
430+
uncast_access_path, component.get_name(), bool_typet()));
431431
}
432432
else
433433
{
@@ -587,9 +587,10 @@ void taint_instrumentert::instrument_instructions_with_shadow_variables(
587587

588588
// There is a possibility, that asgn.lhs().type()!=asgn.rhs().type().
589589
// This may occur only when asgn.rhs().type() is a wrapper of
590-
// a primitive data type and asgn.lhs() accesses the wrapped data.
590+
// a primitive data type and asgn.lhs() is an unwrapped primitive
591+
// (e.g. array length) that cannot carry taint.
591592
// The code below resolves the inconsistency, by applying member
592-
// access to the super filed of the asgn.rhs() until we get to
593+
// access to the super field of the asgn.rhs() until we get to
593594
// the right one.
594595

595596
const auto &lhs_type =
@@ -613,8 +614,8 @@ void taint_instrumentert::instrument_instructions_with_shadow_variables(
613614
const auto &struct_type = to_struct_type(rhs_type);
614615
INVARIANT(
615616
struct_type.has_component(taint_name_of_super_variable()),
616-
"The type difference could occur only for wrapped primitives, "
617-
"so the struct must contain the super variable.");
617+
"Assignment has type mismatch that couldn't be resolved by "
618+
"unwrapping the rhs.");
618619
asgn.rhs() = member_exprt(
619620
asgn.rhs(),
620621
struct_type.get_component(taint_name_of_super_variable()));

0 commit comments

Comments
 (0)