[all-commits] [llvm/llvm-project] 0544c7: Fix a crash from character type confusion interact...

Kevin Frei via All-commits all-commits at lists.llvm.org
Thu Dec 14 11:11:05 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0544c781728a665806b069cb8202acd4f6981a0a
      https://github.com/llvm/llvm-project/commit/0544c781728a665806b069cb8202acd4f6981a0a
  Author: Kevin Frei <kevinfrei at users.noreply.github.com>
  Date:   2023-12-14 (Thu, 14 Dec 2023)

  Changed paths:
    M lldb/include/lldb/Host/Editline.h
    M lldb/source/Host/common/Editline.cpp

  Log Message:
  -----------
  Fix a crash from character type confusion interaction with libedit (#75388)

If you type `settings show <tab>` LLDB might crash, depending on the
version of libedit you're compiled with, and whether you're compiled
with `-DLLDB_EDITLINE_USE_WCHAR=0` (and depending on how the optimizer
lays out the stack...)

The issue has to do with trying to figure out whether the libedit
`getchar` callback is supposed to read a wide or 8 bit character. In
order to maintain backward compatibility, there's really no 'clean' way
to do it. We just have to make sure that we're invoking el_[w]getc with
a buffer that is as wide as the getchar callback (registered by the
`SetGetCharacterFunction` function further down in `Editline.cpp`.

So, it's 'fixed' with a comment, and a wider version of the 'reply'
variable.

Co-authored-by: Kevin Frei <freik at meta.com>




More information about the All-commits mailing list