[PATCH] D63789: [ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 25 19:31:03 PDT 2019


vsapsai added inline comments.


================
Comment at: clang/lib/AST/ODRHash.cpp:73
     AddBoolean(S.isUnarySelector());
     unsigned NumArgs = S.getNumArgs();
     for (unsigned i = 0; i < NumArgs; ++i) {
----------------
rtrieu wrote:
> There's actually a second bug here as well.  When processing an arbitrary number of elements, the number of elements needs to placed before the list.  This line should be added before the for-loop:
> 
> ```
> ID.AddInteger(NumArgs);
> 
> ```
> This change isn't directly related to your original patch, so feel free to skip it.
Thanks for the review, Richard. What would be the way to test the suggested changes? I was mostly thinking about making sure we treat as different
* `-foo:` and `-foo::`
* `-foo:bar::` and `-foo::bar:`

Does it sound reasonable? Maybe you have some test examples for C++ that I can adopt for Objective-C.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63789/new/

https://reviews.llvm.org/D63789





More information about the cfe-commits mailing list