[llvm-bugs] [Bug 39966] New: [CFI] integer to pointer casts are unchecked

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 11 17:30:07 PST 2018


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

            Bug ID: 39966
           Summary: [CFI] integer to pointer casts are unchecked
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

struct A {
  virtual void f();
};

void A::f() {}

int main() {
  A *a = reinterpret_cast<A*>(0x1234);
  A *b = reinterpret_cast<A*>(reinterpret_cast<void *>(0x1234));
  (void)a;
  (void)b;
}

The first cast, integer-to-A* does not generate a CFI check.
The second, through void*, does.

Built with
bin/clang++ -fsanitize=cfi -flto -fvisibility=hidden -fuse-ld=lld -S -emit-llvm

-- 
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/20181212/dafd4767/attachment-0001.html>


More information about the llvm-bugs mailing list