[all-commits] [llvm/llvm-project] b1871c: [sanitizer][win] Change cmdline check to allow dou...

alvinhochun via All-commits all-commits at lists.llvm.org
Fri Mar 24 08:00:15 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b1871ceb1cf6c6954380867d41db3812e9e0dbfc
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2023-03-24 (Fri, 24 Mar 2023)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
    M compiler-rt/test/asan/TestCases/Windows/report_after_syminitialize.cpp

  Log Message:
  [sanitizer][win] Change cmdline check to allow double backslashs

When `llvm-symbolizer.exe` is on the PATH in an entry containing two
consecutive backslashes, sanitizers will try to launch llvm-symbolizer
with its absolute path containing these consecutive backslashes. This
fails a sanity check in `sanitizer_symbolizer_win.cpp`.

According to the documentation of `CommandLineToArgvW` [1] and a MS blog
post [2], backslashes in general, regardless of how many of them in a
row, do not have any special effect, unless when immediately followed by
a double quote.

There already exists a check that fails when the command line arguments
contains double quote, therefore the check for double backslashes can
simply be removed.

[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw
[2]: https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way

Differential Revision: https://reviews.llvm.org/D146621

More information about the All-commits mailing list