monitor.c: Fix infinite loop in monitor's auto-complete
PATCH 1/1 monitor.c: Fix infinite loop in monitor's auto-complete
From: "Dr. David Alan Gilbert" <[email protected]>
--- monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
monitor.c +4 -2
@@ -3696,7 +3696,7 @@ static void monitor_find_completion_by_table(Monitor *mon, {const char *cmdname;int i; -const char *ptype, *str, *name; +const char *ptype, *old_ptype, *str, *name;const mon_cmd_t *cmd;BlockBackend *blk =NULL ;
@@ -3741,7 +3741,9 @@ static void monitor_find_completion_by_table(Monitor *mon, } } str = args[nb_args -1 ]; -while (*ptype =='-' && ptype[1 ] !='\0' ) { + old_ptype =NULL ; +while (*ptype =='-' && old_ptype != ptype) { + old_ptype = ptype; ptype =next_arg_type (ptype); }switch (*ptype) {
Signature · 1 line
2.14.3
Quoted 2 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Please include the details of how to trigger this bug. This helps justify the patch as well as aiding anyone investigating/backporting the same issue in the future.
Aside from that:
Quoted 7 lines · * Stefan Hajnoczi ([email protected]) wrote:
Quoted 2 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Please include the details of how to trigger this bug. This helps justify the patch as well as aiding anyone investigating/backporting the same issue in the future.
OK, I'll include Dimitris's:
The QEMU monitor enters an infinite loop when trying to auto-complete commands that accept only optional parameters. The commands currently affected by this issue are 'info registers' and 'info mtree'.
Quoted 2 lines
Aside from that:
Reviewed-by Stefan Hajnoczi <[email protected]>
Thanks!
Dave
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 5 lines · * Dr. David Alan Gilbert (git) ([email protected]) wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
Reported-by Dimitris Karagkasidis <[email protected]>Fixes 48fe86f6400574165979e0db6f5937ad487b6888Signed-off-by Dr. David Alan Gilbert <[email protected]>
Queued.
Quoted 32 lines
--- monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)monitor.c +4
-2@@ -3696,7 +3696,7 @@ static void monitor_find_completion_by_table(Monitor *mon, {const char *cmdname;int i; -const char *ptype, *str, *name; +const char *ptype, *old_ptype, *str, *name;const mon_cmd_t *cmd;BlockBackend *blk =NULL ;@@ -3741,7 +3741,9 @@ static void monitor_find_completion_by_table(Monitor *mon, } } str = args[nb_args -1 ]; -while (*ptype =='-' && ptype[1 ] !='\0' ) { + old_ptype =NULL ; +while (*ptype =='-' && old_ptype != ptype) { + old_ptype = ptype; ptype =next_arg_type (ptype); }switch (*ptype) {Signature · 1 line
2.14.3
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK