JDevlieghere created this revision.
JDevlieghere added reviewers: labath, lemo, jingham, mib.
Herald added a project: All.
JDevlieghere requested review of this revision.

The assertion checks that the command output doesn't contain any null
bytes. I'm not sure if the intention was to make sure the string wasn't
shorter than the reported length or if this was a way to catch us
accidentally writing an (unformatted) null byte.

Regardless, the command output can be based on user input, so an
assertion doesn't make sense. For example, you should be totally allowed
to call print("\0") from Python. The latter doesn't trigger this bug
because it writes directly to the output stream and therefore bypasses
PrintCommandOutput but that's just an implementation detail.


https://reviews.llvm.org/D122025

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2987,7 +2987,6 @@
   while (size > 0 && !WasInterrupted()) {
     size_t chunk_size = 0;
     for (; chunk_size < size; ++chunk_size) {
-      lldbassert(data[chunk_size] != '\0');
       if (data[chunk_size] == '\n') {
         ++chunk_size;
         break;


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2987,7 +2987,6 @@
   while (size > 0 && !WasInterrupted()) {
     size_t chunk_size = 0;
     for (; chunk_size < size; ++chunk_size) {
-      lldbassert(data[chunk_size] != '\0');
       if (data[chunk_size] == '\n') {
         ++chunk_size;
         break;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to