[LLVMbugs] [Bug 19811] New: UBSan: emit checks that use ASan shadow to detect pointers past the last array element

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 21 01:56:05 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19811

            Bug ID: 19811
           Summary: UBSan: emit checks that use ASan shadow to detect
                    pointers past the last array element
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: glider at google.com
                CC: kcc at google.com, llvmbugs at cs.uiuc.edu,
                    nlewycky at google.com
    Classification: Unclassified

Per §5.7 ¶5 of the C++11 Standard an pointer into array P[N] cannot point past
P + N (although P + N does not belong to the array).

The idea is to make UBSan check operations on array pointer variables to make
sure they're pointing into the arrays or one element past the end of the
arrays. For the following pointer operations:
 P = P + diff
 P = P - diff
 if (P ? Q) {} // for !=, ==, >, <, >=, <= comparisons


the frontend should emit calls to a function that makes the following check
based on ASan shadow:

  if P is not close to 0 {
    if P is not addressable {
      if P-1 is not addressable {
        report error;
      }
    }
  }
  return;

-- 
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/20140521/0d1795f1/attachment.html>


More information about the llvm-bugs mailing list