2017-12-10 22:00:49 +00:00
|
|
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-6.5-readline-long-line-crash-test.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Fix readline segfault on excessively long hand-typed lines.
|
|
|
|
;;=fedoratest
|
2017-12-04 19:24:00 +00:00
|
|
|
|
2006-12-19 19:26:15 +00:00
|
|
|
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp
|
2019-01-21 17:16:00 +00:00
|
|
|
@@ -0,0 +1,104 @@
|
2006-12-19 19:26:15 +00:00
|
|
|
+# Copyright 2006 Free Software Foundation, Inc.
|
|
|
|
+
|
|
|
|
+# This program is free software; you can redistribute it and/or modify
|
|
|
|
+# it under the terms of the GNU General Public License as published by
|
|
|
|
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+# (at your option) any later version.
|
|
|
|
+#
|
|
|
|
+# This program is distributed in the hope that it will be useful,
|
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+# GNU General Public License for more details.
|
|
|
|
+#
|
|
|
|
+# You should have received a copy of the GNU General Public License
|
|
|
|
+# along with this program; if not, write to the Free Software
|
|
|
|
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
+
|
|
|
|
+# Please email any bugs, comments, and/or additions to this file to:
|
|
|
|
+# bug-gdb@prep.ai.mit.edu
|
|
|
|
+
|
|
|
|
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
+
|
|
|
|
+# This file is part of the gdb testsuite.
|
|
|
|
+
|
|
|
|
+#
|
|
|
|
+# Tests for readline buffer overflow.
|
|
|
|
+#
|
|
|
|
+
|
|
|
|
+if $tracelevel {
|
|
|
|
+ strace $tracelevel
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+global env
|
|
|
|
+
|
2019-01-21 17:16:00 +00:00
|
|
|
+save_vars { env(INPUTRC) env(GDBHISTFILE) env(HISTSIZE) TERM timeout } {
|
|
|
|
+ # The arrow key test relies on the standard VT100 bindings, so
|
|
|
|
+ # make sure that an appropriate terminal is selected. The same
|
|
|
|
+ # bug doesn't show up if we use ^P / ^N instead.
|
|
|
|
+ setenv TERM vt100
|
2006-12-19 19:26:15 +00:00
|
|
|
+
|
2019-01-21 17:16:00 +00:00
|
|
|
+ # Don't let a .inputrc file or an existing setting of INPUTRC mess up
|
|
|
|
+ # the test results. Even if /dev/null doesn't exist on the particular
|
|
|
|
+ # platform, the readline library will use the default setting just by
|
|
|
|
+ # failing to open the file. OTOH, opening /dev/null successfully will
|
|
|
|
+ # also result in the default settings being used since nothing will be
|
|
|
|
+ # read from this file.
|
|
|
|
+ set env(INPUTRC) "/dev/null"
|
|
|
|
+
|
|
|
|
+ set timeout 600
|
2006-12-19 19:26:15 +00:00
|
|
|
+
|
2019-01-21 17:16:00 +00:00
|
|
|
+ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
|
|
|
|
+ set env(HISTSIZE) "10"
|
2006-12-19 19:26:15 +00:00
|
|
|
+
|
2019-01-21 17:16:00 +00:00
|
|
|
+ gdb_exit
|
|
|
|
+ gdb_start
|
|
|
|
+ gdb_reinitialize_dir $srcdir/$subdir
|
2006-12-19 19:26:15 +00:00
|
|
|
+
|
2019-01-21 17:16:00 +00:00
|
|
|
+
|
|
|
|
+ set width 11
|
|
|
|
+ gdb_test "set width $width" \
|
|
|
|
+ "" \
|
|
|
|
+ "Setting width to $width."
|
|
|
|
+ #gdb_test "set height 1" \
|
|
|
|
+ # "" \
|
|
|
|
+ # "Setting height to 1."
|
|
|
|
+ send_gdb "run X"
|
|
|
|
+ set i 0
|
|
|
|
+ # It crashes using `set width 7' on `set total 3560'.
|
|
|
|
+ # Sometimes it corrupts screen on `set width 7'.
|
|
|
|
+ # Bugreport used `set total 130001':
|
|
|
|
+ # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
|
|
|
+ # Check also `timeout' above.
|
|
|
|
+ set total 4200
|
|
|
|
+ gdb_expect {
|
2006-12-19 19:26:15 +00:00
|
|
|
+ -re X {
|
2019-01-21 17:16:00 +00:00
|
|
|
+ incr i
|
|
|
|
+ if {$i <= $total} {
|
|
|
|
+ send_gdb "X"
|
|
|
|
+ exp_continue
|
|
|
|
+ }
|
2006-12-19 19:26:15 +00:00
|
|
|
+ }
|
|
|
|
+ -re "\[ \b\r\n\]" {
|
2019-01-21 17:16:00 +00:00
|
|
|
+ exp_continue
|
2006-12-19 19:26:15 +00:00
|
|
|
+ }
|
|
|
|
+ eof {
|
2019-01-21 17:16:00 +00:00
|
|
|
+ fail "gdb sending total $total characters"
|
|
|
|
+ note "Failed after sending $i characters, reason: EOF"
|
|
|
|
+ gdb_clear_suppressed
|
2006-12-19 19:26:15 +00:00
|
|
|
+ }
|
|
|
|
+ timeout {
|
2019-01-21 17:16:00 +00:00
|
|
|
+ fail "gdb sending total $total characters"
|
|
|
|
+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
|
|
|
|
+ gdb_clear_suppressed
|
2006-12-19 19:26:15 +00:00
|
|
|
+ }
|
|
|
|
+ default {
|
2019-01-21 17:16:00 +00:00
|
|
|
+ fail "gdb sending total $total characters"
|
|
|
|
+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
|
|
|
|
+ gdb_clear_suppressed
|
2006-12-19 19:26:15 +00:00
|
|
|
+ }
|
2019-01-21 17:16:00 +00:00
|
|
|
+ }
|
|
|
|
+ send_gdb "\r"
|
|
|
|
+ gdb_test "" \
|
|
|
|
+ "No executable file specified..*" \
|
|
|
|
+ "All the characters transferred"
|
2006-12-19 19:26:15 +00:00
|
|
|
+}
|