Sanity check the inputs to SBCommandInterpreter::HandleCompletion

llvm-svn: 145840
This commit is contained in:
Jim Ingham 2011-12-05 19:24:15 +00:00
parent 0e069e2aa9
commit ac01260545
1 changed files with 13 additions and 0 deletions

View File

@ -124,6 +124,19 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
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;