- Added insufficient storage check for arrays
- Added align support check
Based on https://reviews.llvm.org/D76229
Differential D76996
[analyzer] Improve PlacementNewChecker f00kat on Mar 28 2020, 1:45 PM. Authored by
Details
Based on https://reviews.llvm.org/D76229
Diff Detail
Event TimelineComment Actions That was fast! Looks alright.
Comment Actions Wohoow! I am impressed, this is really nice work, I like it! :) Could not find any glitch, looks good from my side once you address NoQ's concerns.
Comment Actions
void f7() { short b[10]; // ok. 2(short align) + 3*2(index '1' offset) ::new (&b[3]) long; }
Comment Actions LGTM! Thanks! But I am not that confident with the element regions and field regions, so @NoQ could you please take another look?
Comment Actions
Comment Actions Ping? :)
Comment Actions
Comment Actions
This could be an issue not just with alignment but maybe with the size as well, I am not sure if we handle the offset properly in compound cases like this: Xi.b[0].a[1][6]. Even though the above issue is still not investigated/handled, I think this patch is now acceptable because seems like most of the practical cases are handled. We could further investigate the concern and improve in a follow-up patch. Comment Actions Thanks for feedback! I still have no rights to push in the repo so if you think that it is acceptable could you commit it please?
|
Before i forget: Ideally @martong should have subscribed to [[ https://clang.llvm.org/doxygen/classclang_1_1ento_1_1CheckerDocumentation.html#a7fdb3b5ff726f4c5e782cef0d59c01ad | checkNewAllocator ]] because it fires before the construct-expression whereas this callback fires after construct-expression which is too late as the UB we're trying to catch has occured much earlier.