[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 12:53:53 PDT 2024
================
@@ -278,6 +278,23 @@ int *mallocRegion(void) {
return mem;
}
+int *custom_calloc(size_t a, size_t b) {
+ size_t res;
+ if (__builtin_mul_overflow(a, b, &res))
+ return 0;
+
+ return malloc(res);
+}
+
+int *mallocRegionOverflow(void) {
+ int *mem = (int*)custom_calloc(4, 10);
+
+ mem[20] = 10;
----------------
steakhal wrote:
Note: We don't have a FP here only because the `suppress-null-return-paths` heuristic is enabled by default - because of the state-split even in the concrete-concrete case.
https://github.com/llvm/llvm-project/pull/102602
More information about the cfe-commits
mailing list