[llvm-bugs] [Bug 46885] New: Arrays should not be out-of-bound accessed. (llvm-project/llvm/lib/IR/AutoUpgrade.cpp:line 977)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 29 02:28:55 PDT 2020


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

            Bug ID: 46885
           Summary: Arrays should not be out-of-bound accessed.
                    (llvm-project/llvm/lib/IR/AutoUpgrade.cpp:line 977)
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Core LLVM classes
          Assignee: unassignedbugs at nondot.org
          Reporter: info at ustchcs.com
                CC: llvm-bugs at lists.llvm.org

Arrays should not be out-of-bound accessed. 

The size of array 'Indices' is 4 (Line:975), 'i' ranges from 0 to 'NumElts' and
'NumElts' is lower than 8 (not 4). So in line 977, 'Indices[i]' could result in
out-of-bound access.

(commit: e3546c78cabfbf670391a57766872f0a8e28a423)

llvm-project/llvm/lib/IR/AutoUpgrade.cpp:

   974    if (NumElts < 8) {
   975      int Indices[4];
   976      for (unsigned i = 0; i != NumElts; ++i)
   977        Indices[i] = i;
   978      Mask = Builder.CreateShuffleVector(Mask, Mask,
   979                                         makeArrayRef(Indices, NumElts),
   980                                         "extract");
   981    }
   982  
   983    return Mask;
   984  }

Reported by: Ustchcs Toolsets Bugfinder
(bugfinder-4.5: Arrays should not be out-of-bound accessed.)

-- 
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/20200729/b32ce0bc/attachment.html>


More information about the llvm-bugs mailing list