Fix a bug that the glob pattern parser falls in an infinite loop for invalid patterns.

llvm-svn: 290160
This commit is contained in:
Rui Ueyama 2016-12-20 03:12:28 +00:00
parent cbe1eba0c6
commit 0be9720875
2 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,7 @@ BitVector GlobPattern::scan(StringRef &S) {
size_t End = S.find(']', 1);
if (End == StringRef::npos) {
error("invalid glob pattern: " + Original);
S = "";
return BitVector(256, false);
}
StringRef Chars = S.substr(1, End - 1);

View File

@ -45,6 +45,11 @@
# RUN: ld.lld --version-script %t8.script -shared %t.o -o %t8.so
# RUN: llvm-readobj -V %t8.so | FileCheck %s --check-prefix=ABBABC
# RUN: echo "FOO { global: extern \"C++\" { a[; }; };" > %t9.script
# RUN: not ld.lld --version-script %t9.script -shared %t.o -o %t9.so 2>&1 \
# RUN: | FileCheck %s --check-prefix=ERROR
# ERROR: invalid glob pattern: a[
.text
.globl _Z3abci
.type _Z3abci,@function