Skip to content

Checked region finder doesn't consider all casts inserted by CastPlacementVisitor #469

Open
@john-h-kastner

Description

@john-h-kastner

If the argument to a function is a literal expression that does not have an associated ConstraintVariable, then CheckedRegionFinder will make the containing function _Checked even if the function call requires a cast.

For expression with constraint variables, a function call can only require a cast if either the parameter constraint variable or the argument constraint variable is wild. If the argument does not get any constraint variables, for example in the case of an integer literal, but a cast is still required, then the checked region finder considers the code safe and will add a checked region.

void foo(char *a){}
void bar() {
  foo(1);
}

will convert to

void foo(_Ptr<char> a)_Checked {}

void bar() _Checked {
  foo(_Assume_bounds_cast<_Ptr<char>>(1));
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions