Skip to content
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

Consider emitting warnings for uses of pointers that violate their bounds-safe interfaces #1158

Open
secure-sw-dev-bot opened this issue Jan 17, 2022 · 0 comments

Comments

@secure-sw-dev-bot
Copy link

This issue was copied from checkedc/checkedc-clang#1159


In the future, we may want to consider warning the user if we can detect that the user of a pointer with a bounds-safe interface does not satisfy its bounds-safe interface. For example:

void f(int *p : itype(_Array_ptr<int>),
       int *q : bounds(unknown),
       int *r : count(2),
       int *s : count(1),
       int *t : itype(_Ptr<int>)) {
  // p has implicit declared bounds of bounds(unknown). p should not be dereferenced.
  *p;

  // q has explicit declared bounds of bounds(unknown). This is ok.
  *q;

  // The bounds of s are too small for the declared bounds of r.
  // This could be a bug in the user's chosen itype bounds.
  r = s;

  // Pointer arithmetic is not allowed on _Ptrs. The could be a bug in the user's chosen itype.
  t = t + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant