summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-cov/double_dots.c
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-06-29 16:22:12 +0000
committerVedant Kumar <vsk@apple.com>2016-06-29 16:22:12 +0000
commit4a54abeacd48f5f098946bc402f45ca7120fe16d (patch)
tree1294eeb113ed2cd051fe1abd857f5f187a50270c /llvm/test/tools/llvm-cov/double_dots.c
parente3fa8f64da27e597f86205b6b26ff03c7bd1f1c7 (diff)
downloadbcm5719-llvm-4a54abeacd48f5f098946bc402f45ca7120fe16d.tar.gz
bcm5719-llvm-4a54abeacd48f5f098946bc402f45ca7120fe16d.zip
[llvm-cov] Do not allow ".." to escape the coverage sub-directory
In -output-dir mode, file reports are placed into a "coverage" directory. If filenames in the coverage mapping contain "..", they might escape out of this directory. Fix the problem by removing ".." from source filenames (expand the path component). llvm-svn: 274135
Diffstat (limited to 'llvm/test/tools/llvm-cov/double_dots.c')
-rw-r--r--llvm/test/tools/llvm-cov/double_dots.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/double_dots.c b/llvm/test/tools/llvm-cov/double_dots.c
new file mode 100644
index 00000000000..fe78d91e9dd
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/double_dots.c
@@ -0,0 +1,11 @@
+// To create the covmapping for this file, copy this file to /tmp/dots/test.c,
+// cd into /tmp/dots, and pass "../dots/double_dots.c" to the compiler. Use
+// llvm-cov convert-for-testing to extract the covmapping.
+
+// RUN: llvm-profdata merge %S/Inputs/double_dots.proftext -o %t.profdata
+// RUN: llvm-cov show %S/Inputs/double_dots.covmapping -instr-profile=%t.profdata -o %t.dir
+// RUN: FileCheck -input-file=%t.dir/index.txt %s
+
+// CHECK-NOT: coverage{{.*}}dots{{.*}}..{{.*}}dots
+
+int main() {}
OpenPOWER on IntegriCloud