[llvm-bugs] [Bug 47130] New: Detect buffer underflow

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 12 04:13:13 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47130

            Bug ID: 47130
           Summary: Detect buffer underflow
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: orgads at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

It would be nice if Clang Analyzer detected buffer underflow.

For example:
#include <string.h>

typedef int BOOL;
#define ELEMENTS 20
BOOL array[ELEMENTS];

void foo()
{
    memset(array,0, ELEMENTS); /* BOOL isn't 1 byte but 4 bytes long */
}


PVS-Studio detects this. See https://godbolt.org/z/hen3Kn

Source:
https://stackoverflow.com/q/26102671/764870

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200812/78e3012d/attachment.html>


More information about the llvm-bugs mailing list