<div dir="ltr">Hi,<br><br>I've found a crash in lld when using linker script with wildcard matching. <br>An example linker script:<br><br>INPUT(os/main.o os/foo.o os/startup.o)<br>OUTPUT(k.bin)<br><br>SECTIONS<br>{<br>    . = 0x0<br>    .text : { *startup.o (.text) }<br>    .text.2 : { *(.tex*) }<br>}<br><br>I've wrote up a patch to fix this crash.<br><br>Index: tools/lld/lib/ReaderWriter/LinkerScript.cpp<br>IDEA additional info:<br>Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP<br><+>UTF-8<br>===================================================================<br>--- tools/lld/lib/ReaderWriter/LinkerScript.cpp    (revision 8570c61c3fce7de2f655a20f8b184efa1bd97c00)<br>+++ tools/lld/lib/ReaderWriter/LinkerScript.cpp    (revision )<br>@@ -2557,7 +2557,7 @@<br>     switch (*j) {<br>     case '*':<br>       while (!wildcardMatch(pattern.drop_front(j - pattern.begin() + 1),<br>-                            name.drop_front(i - name.begin() + 1))) {<br>+                            name.drop_front(i - name.begin()))) {<br>         if (i == name.end())<br>           return false;<br>         ++i;<br>@@ -2565,6 +2565,7 @@<br>       break;<br>     case '?':<br>       // Matches any character<br>+      ++i;<br>       break;<br>     case '[': {<br>       // Matches a range of characters specified between brackets<br>@@ -2577,20 +2578,22 @@<br>         return false;<br> <br>       j = pattern.begin() + end;<br>+      ++i;<br>       break;<br>     }<br>     case '\\':<br>       ++j;<br>       if (*j != *i)<br>         return false;<br>+      ++i;<br>       break;<br>     default:<br>       // No wildcard character means we must match exactly the same char<br>       if (*j != *i)<br>         return false;<br>+      ++i;<br>       break;<br>     }<br>-    ++i;<br>   }<br> <br>   // If our pattern has't consumed the entire string, it is not a match<br><br>Cheers,<br>Huang<br></div>