[PATCH] D77148: [analyzer] ApiModeling: Add buffer size arg constraint with multiplier involved

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 06:03:05 PDT 2020


balazske added inline comments.


================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints.c:155
+  __buf_size_arg_constraint_mul(buf, s, sizeof(short));
+  clang_analyzer_eval(s * sizeof(short) <= 6); // \
+  // report-warning{{TRUE}} \
----------------
`s <= 3` is better here? We know that the buffer has space for 3 short's. But it is better to assume nothing about `sizeof(short)`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77148





More information about the cfe-commits mailing list