[all-commits] [llvm/llvm-project] 51bb21: [Analyzer][VLASizeChecker] Check for VLA size over...

Balázs Kéri via All-commits all-commits at lists.llvm.org
Tue May 19 00:44:17 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 51bb2128ef03985fddf2a84f17d3276f4ae2c6ad
      https://github.com/llvm/llvm-project/commit/51bb2128ef03985fddf2a84f17d3276f4ae2c6ad
  Author: Balázs Kéri <1.int32 at gmail.com>
  Date:   2020-05-19 (Tue, 19 May 2020)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
    A clang/test/Analysis/vla-overflow.c

  Log Message:
  -----------
  [Analyzer][VLASizeChecker] Check for VLA size overflow.

Summary:
Variable-length array (VLA) should have a size that fits into
a size_t value. According to the standard: "std::size_t can
store the maximum size of a theoretically possible object of
any type (including array)" (this is applied to C too).

The size expression is evaluated at the definition of the
VLA type even if this is a typedef.
The evaluation of the size expression in itself might cause
problems if it overflows.

Reviewers: Szelethus, baloghadamsoftware, martong, gamesh411

Reviewed By: Szelethus, martong, gamesh411

Subscribers: whisperity, rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list