Handle Windows drive letters and ".." for --reproduce.
authorRui Ueyama <ruiu@google.com>
Tue, 26 Apr 2016 20:36:46 +0000 (20:36 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 26 Apr 2016 20:36:46 +0000 (20:36 +0000)
commit673b609586c1ae7a61108342ec6353989bee1497
tree984ea54596040b05eb18783b7e2ca371d3a7b014
parent2f1459cbb7d7c37223ed0a52df11af8425e26599
Handle Windows drive letters and ".." for --reproduce.

When --reproduce <path> is given, then we need to concatenate input
file paths to the given path to save input files to the directory.
Previously, path concatenation didn't handle Windows drive letters
so it could generate invalid paths such as "C:\D:\foo". It also didn't
handle ".." path components, so it could produce some bad paths
such as "foo/../../etc/passwd".

In this patch, Windows drive letters and ".." are removed before
concatenating paths.

Differential Revision: http://reviews.llvm.org/D19551

llvm-svn: 267600
lld/ELF/Driver.cpp
lld/test/ELF/reproduce.s