diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-12-20 03:12:28 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-12-20 03:12:28 +0000 |
| commit | 0be97208751110c8c2cf4cfb0fb29537d0441b52 (patch) | |
| tree | f1b87f6dd05823fc3cb0eee146747610c35217fc | |
| parent | cbe1eba0c6df4a6dd5a19fd4f6ba5e05cce7f101 (diff) | |
| download | bcm5719-llvm-0be97208751110c8c2cf4cfb0fb29537d0441b52.tar.gz bcm5719-llvm-0be97208751110c8c2cf4cfb0fb29537d0441b52.zip | |
Fix a bug that the glob pattern parser falls in an infinite loop for invalid patterns.
llvm-svn: 290160
| -rw-r--r-- | lld/ELF/Strings.cpp | 1 | ||||
| -rw-r--r-- | lld/test/ELF/version-script-complex-wildcards.s | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lld/ELF/Strings.cpp b/lld/ELF/Strings.cpp index 349325cb71d..47752a61423 100644 --- a/lld/ELF/Strings.cpp +++ b/lld/ELF/Strings.cpp @@ -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); diff --git a/lld/test/ELF/version-script-complex-wildcards.s b/lld/test/ELF/version-script-complex-wildcards.s index 8291c25bed5..61e1069e2ea 100644 --- a/lld/test/ELF/version-script-complex-wildcards.s +++ b/lld/test/ELF/version-script-complex-wildcards.s @@ -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 |

