From 95fb23ab37e5e348788bb34623ebdc1e583e1ec8 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 3 Sep 2019 22:23:14 +0000 Subject: [InstrProf] Tighten a check for malformed data records in raw profiles The check needs to validate a counter offset before performing pointer arithmetic with the (potentially corrupt) offset. Found by UBSan's pointer overflow check. rdar://54843625 Differential Revision: https://reviews.llvm.org/D66979 llvm-svn: 370826 --- .../Inputs/malformed-ptr-to-counter-array.profraw | Bin 0 -> 563560 bytes .../llvm-profdata/malformed-ptr-to-counter-array.test | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw create mode 100644 llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test (limited to 'llvm/test/tools/llvm-profdata') diff --git a/llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw b/llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw new file mode 100644 index 00000000000..72fddd76fc6 Binary files /dev/null and b/llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw differ diff --git a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test new file mode 100644 index 00000000000..24a68e35fad --- /dev/null +++ b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test @@ -0,0 +1,5 @@ +REQUIRES: zlib + +RUN: not llvm-profdata merge -o /dev/null %p/Inputs/malformed-ptr-to-counter-array.profraw 2>&1 | FileCheck %s + +CHECK: Malformed instrumentation profile data -- cgit v1.2.3