Skip to content

Commit 5424be6

Browse files
committed
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. 2018-08-17 Tom Tromey <tom@tromey.com> * cli/cli-script.c (read_next_line): Pass 0 as repeat argument to command_line_input.
1 parent 441cee9 commit 5424be6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

gdb/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2018-08-17 Tom Tromey <tom@tromey.com>
2+
3+
* cli/cli-script.c (read_next_line): Pass 0 as repeat argument to
4+
command_line_input.
5+
16
2018-07-13 Simon Marchi <simon.marchi@polymtl.ca>
27

38
* symfile.c (set_objfile_default_section_offset): Remove struct

gdb/cli/cli-script.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ read_next_line (void)
903903
else
904904
prompt_ptr = NULL;
905905

906-
return command_line_input (prompt_ptr, from_tty, "commands");
906+
return command_line_input (prompt_ptr, 0, "commands");
907907
}
908908

909909
/* Return true if CMD's name is NAME. */

0 commit comments

Comments
 (0)