llvm/test/tools/llvm-cov/double_dots.c
Vedant Kumar 651e3ffa96 [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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274135 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 16:22:12 +00:00

12 lines
498 B
C

// 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() {}