[PATCH] D38971: Enhance libsanitizer support for invalid-pointer-pair.
Kostya Serebryany via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 16:26:18 PST 2017
kcc added a comment.
Add couple more comments, sorry for delay.
Alexey, your turn now.
================
Comment at: lib/asan/asan_report.cc:316
+ // check whether left is a stack memory pointer
+ uptr shadow_offset1, shadow_offset2;
+ if ((shadow_offset1 = t->GetStackFrameVariableBeginning(left))) {
----------------
Ouch. Please don't do this.
uptr a;
if((a = foo())) ...
It's easy to misinterpret such code.
Instead, do
if (uptr a = foo()) ...
================
Comment at: lib/asan/asan_report.cc:317
+ uptr shadow_offset1, shadow_offset2;
+ if ((shadow_offset1 = t->GetStackFrameVariableBeginning(left))) {
+ if ((shadow_offset2 = t->GetStackFrameVariableBeginning(right))
----------------
here and below instead of
if (a && b) return true; else return false;
prefer
return a && b;
https://reviews.llvm.org/D38971
More information about the llvm-commits
mailing list