This is the runtime support for this cfe patch to support pointer overflow checking:
http://reviews.llvm.org/D20322
Differential D20323
[ubsan] runtime support for pointer overflow checking regehr on May 17 2016, 4:59 AM. Authored by
Details This is the runtime support for this cfe patch to support pointer overflow checking: http://reviews.llvm.org/D20322
Diff Detail
Event TimelineComment Actions LGTM with the test fix.
Comment Actions Hmm, this test actually is wonky if argv[0] happens to be negative when represented as intptr_t... which happens on -m32 for my machine. I'll see about constructing a better test case! Doing this in a 'portable' manner is amusingly challenging... Comment Actions Fixed test: // RUN: %clangxx -fsanitize=pointer-overflow %s -o %t // RUN: %t 1 2>&1 | FileCheck %s --check-prefix=ERR // RUN: %t 0 2>&1 | FileCheck %s --check-prefix=SAFE // RUN: %t -1 2>&1 | FileCheck %s --check-prefix=SAFE #include <stdio.h> #include <stdint.h> #include <stdlib.h> int main(int argc, char *argv[]) { // SAFE-NOT: runtime error // ERR: runtime error: pointer index expression with base {{.*}} overflowed to char *p = (char *)(UINTPTR_MAX); printf("%p\n", p + atoi(argv[1])); return 0; } I'm not sure how to update the revision, but this test should do the trick :). |