[analyzer][docs] NFC: Extend documentation for MallocOverflow checker
authorBorsik Gabor <gabor.borsik@gmail.com>
Sat, 23 Nov 2019 19:55:19 +0000 (20:55 +0100)
committerBorsik Gabor <gabor.borsik@gmail.com>
Sat, 23 Nov 2019 19:55:19 +0000 (20:55 +0100)
Patch by Benics Balázs

Differential Revision: https://reviews.llvm.org/D70596

clang/docs/analyzer/checkers.rst

index a751b14809752945fa0fda2e60efac6b6403b9e8..b410c085878936f977382f13a8978d86b65860c3 100644 (file)
@@ -1974,6 +1974,12 @@ Check for overflows in the arguments to malloc().
    void *p = malloc(n * sizeof(int)); // warn
  }
 
+ void test2(int n) {
+   if (n > 100) // gives an upper-bound
+     return;
+   void *p = malloc(n * sizeof(int)); // no warning
+ }
+
 .. _alpha-security-MmapWriteExec:
 
 alpha.security.MmapWriteExec (C)