[Lldb-commits] [lldb] r145840 - /lldb/trunk/source/API/SBCommandInterpreter.cpp
Jim Ingham
jingham at apple.com
Mon Dec 5 11:24:15 PST 2011
Author: jingham
Date: Mon Dec 5 13:24:15 2011
New Revision: 145840
URL: http://llvm.org/viewvc/llvm-project?rev=145840&view=rev
Log:
Sanity check the inputs to SBCommandInterpreter::HandleCompletion
Modified:
lldb/trunk/source/API/SBCommandInterpreter.cpp
Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=145840&r1=145839&r2=145840&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Mon Dec 5 13:24:15 2011
@@ -124,6 +124,19 @@
SBStringList &matches)
{
int num_completions = 0;
+
+ // Sanity check the arguments that are passed in:
+ // cursor & last_char have to be within the current_line.
+ if (current_line == NULL || cursor == NULL || last_char == NULL)
+ return 0;
+
+ if (cursor < current_line || last_char < current_line)
+ return 0;
+
+ size_t current_line_size = strlen (current_line);
+ if (cursor - current_line > current_line_size || last_char - current_line > current_line_size)
+ return 0;
+
if (m_opaque_ptr)
{
lldb_private::StringList lldb_matches;
More information about the lldb-commits
mailing list