Page MenuHomePhabricator

[ubsan] Detect invalid unsigned pointer index expression (compiler-rt)

Authored by vsk on Jun 5 2017, 12:57 PM.

Diff Detail


Event Timeline

vsk created this revision.Jun 5 2017, 12:57 PM
regehr added inline comments.Jun 5 2017, 1:03 PM
6 ↗(On Diff #101448)

I don't know that it matters too much in practice but it may be better to make p a valid pointer instead of casting 7 into a pointer, which is at best implementation defined behavior.

vsk updated this revision to Diff 101496.Jun 5 2017, 5:55 PM
  • Avoid implementation-defined behavior in the test.
  • Fix the signed-ness check: to check that the sign bit is off, we need 'x >= 0'. Caught by running check-ubsan.
This revision was automatically updated to reflect the committed changes.