Fix use-after-free in number_or_range_parser
authorTom Tromey <tom@tromey.com>
Thu, 16 Aug 2018 00:37:00 +0000 (18:37 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 17 Aug 2018 22:37:39 +0000 (16:37 -0600)
commit12582533306990c9406aedd960fa411c317a67de
tree74005391dc703c6ff07974487a81ce2507ca8c55
parentbfb1e8c15a6b7d02cd0b9a124d01722a07ebf09a
Fix use-after-free in number_or_range_parser

-fsanitize=address showed a use-after-free in number_or_range_parser.

The cause was that handle_line_of_input could stash the input into
"saved_command_line", and then this could be freed by reentrant calls.

This fixes the bug by preventing commands that are read by "commands"
from being eligible for repeating.

gdb/ChangeLog
2018-08-17  Tom Tromey  <tom@tromey.com>

* cli/cli-script.c (read_next_line): Pass 0 as repeat argument to
command_line_input.
gdb/ChangeLog
gdb/cli/cli-script.c