[all-commits] [llvm/llvm-project] f9d809: Improve error handling for invalid breakpoint `-t`...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Thu Dec 8 17:54:09 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f9d8090a90a1f1f9ddf6aebb82e7fc4c1dbcf030
      https://github.com/llvm/llvm-project/commit/f9d8090a90a1f1f9ddf6aebb82e7fc4c1dbcf030
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M lldb/source/Commands/CommandObjectBreakpoint.cpp

  Log Message:
  -----------
  Improve error handling for invalid breakpoint `-t` and `-x` options.

Breakpoint option `-t` checks that `option_arg` is empty by checking `option_arg[0] == '\0'`. This is unnecessary: the next two checks for comparing against "current" and calling `getAsInteger` already gracefully handle an empty StringRef. If the `option_arg` string is empty, this crashes (or triggers an assertion failure with asserts enabled). Also, this sets the thread id to `LLDB_INVALID_THREAD_ID` if the thread id is invalid -- it should just not set the thread id.

Likewise of `-x` which checks `option_arg[0] == '\n'` unnecessarily.

I believe both of these bugs are unreachable via normal LLDB usage, and are only accessible via the fuzzer -- most likely some other CLI parsing is trimming whitespace and rejecting empty inputs. Still, it doesn't hurt to simplify this bit.




More information about the All-commits mailing list