[PATCH] D33910: [ubsan] Detect invalid unsigned pointer index expression (clang)

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 12:34:40 PDT 2017


efriedma added inline comments.


================
Comment at: cfe/trunk/lib/CodeGen/CGExprScalar.cpp:2666
+  bool isSigned = indexOperand->getType()->isSignedIntegerOrEnumerationType();
+  bool mayHaveNegativeGEPIndex = isSigned || isSubtraction;
+
----------------
This logic doesn't look quite right; what happens here if you write "p - SIZE_MAX"?


Repository:
  rL LLVM

https://reviews.llvm.org/D33910





More information about the cfe-commits mailing list