[PATCH] D63110: Fix a crash in option parsing.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 14:12:46 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363101: Fix a crash in option parsing. (authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D63110?vs=203940&id=204164#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63110/new/
https://reviews.llvm.org/D63110
Files:
lldb/trunk/lit/Driver/Inputs/process_attach_pid.in
lldb/trunk/lit/Driver/TestProcessAttach.test
lldb/trunk/source/Interpreter/Options.cpp
Index: lldb/trunk/source/Interpreter/Options.cpp
===================================================================
--- lldb/trunk/source/Interpreter/Options.cpp
+++ lldb/trunk/source/Interpreter/Options.cpp
@@ -1362,6 +1362,12 @@
int long_options_index = -1;
val = OptionParser::Parse(argv.size(), &*argv.begin(), sstr.GetString(),
long_options, &long_options_index);
+
+ if ((size_t)OptionParser::GetOptionIndex() > argv.size()) {
+ error.SetErrorStringWithFormat("option requires an argument");
+ break;
+ }
+
if (val == -1)
break;
Index: lldb/trunk/lit/Driver/Inputs/process_attach_pid.in
===================================================================
--- lldb/trunk/lit/Driver/Inputs/process_attach_pid.in
+++ lldb/trunk/lit/Driver/Inputs/process_attach_pid.in
@@ -0,0 +1 @@
+process attach --pid
Index: lldb/trunk/lit/Driver/TestProcessAttach.test
===================================================================
--- lldb/trunk/lit/Driver/TestProcessAttach.test
+++ lldb/trunk/lit/Driver/TestProcessAttach.test
@@ -0,0 +1,2 @@
+# RUN: %lldb -x -b -S %S/Inputs/process_attach_pid.in 2>&1 | FileCheck %s
+# CHECK: requires an argument
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63110.204164.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190611/88bd6be0/attachment.bin>
More information about the llvm-commits
mailing list