2017-12-08 04:31:26 +00:00
|
|
|
From 2b4ff32b8c143887747c49a67d32f945412278b9 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
|
|
|
|
|
|
|
|
FileName: 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
|
|
|
---
|
|
|
|
gdb/testsuite/gdb.base/readline-overflow.exp | 126 +++++++++++++++++++++++++++
|
|
|
|
1 file changed, 126 insertions(+)
|
|
|
|
create mode 100644 gdb/testsuite/gdb.base/readline-overflow.exp
|
2006-12-19 19:26:15 +00:00
|
|
|
|
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
|
|
|
|
index 0000000000..5e46816d21
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp
|
2016-02-16 09:54:56 +00:00
|
|
|
@@ -0,0 +1,126 @@
|
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
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+# 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.
|
|
|
|
+global env
|
|
|
|
+if [info exists env(INPUTRC)] {
|
|
|
|
+ set old_inputrc $env(INPUTRC)
|
|
|
|
+}
|
|
|
|
+set env(INPUTRC) "/dev/null"
|
|
|
|
+
|
|
|
|
+set oldtimeout1 $timeout
|
|
|
|
+set timeout 600
|
|
|
|
+
|
|
|
|
+if [info exists env(GDBHISTFILE)] {
|
|
|
|
+ set old_gdbhistfile $env(GDBHISTFILE)
|
|
|
|
+}
|
|
|
|
+if [info exists env(HISTSIZE)] {
|
|
|
|
+ set old_histsize $env(HISTSIZE)
|
|
|
|
+}
|
|
|
|
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
|
|
|
|
+set env(HISTSIZE) "10"
|
|
|
|
+
|
|
|
|
+gdb_exit
|
|
|
|
+gdb_start
|
|
|
|
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+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 {
|
|
|
|
+ -re X {
|
|
|
|
+ incr i
|
|
|
|
+ if {$i <= $total} {
|
|
|
|
+ send_gdb "X"
|
|
|
|
+ exp_continue
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ -re "\[ \b\r\n\]" {
|
|
|
|
+ exp_continue
|
|
|
|
+ }
|
|
|
|
+ eof {
|
|
|
|
+ fail "gdb sending total $total characters"
|
|
|
|
+ note "Failed after sending $i characters, reason: EOF"
|
|
|
|
+ gdb_clear_suppressed
|
|
|
|
+ }
|
|
|
|
+ timeout {
|
|
|
|
+ fail "gdb sending total $total characters"
|
|
|
|
+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
|
|
|
|
+ gdb_clear_suppressed
|
|
|
|
+ }
|
|
|
|
+ default {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+}
|
2016-02-16 09:54:56 +00:00
|
|
|
+send_gdb "\r"
|
|
|
|
+gdb_test "" \
|
2006-12-19 19:26:15 +00:00
|
|
|
+ "No executable file specified..*" \
|
|
|
|
+ "All the characters transferred"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+# Restore globals modified in this test...
|
|
|
|
+if [info exists old_inputrc] {
|
|
|
|
+ set env(INPUTRC) $old_inputrc
|
|
|
|
+} else {
|
|
|
|
+ unset env(INPUTRC)
|
|
|
|
+}
|
|
|
|
+if [info exists old_gdbhistfile] {
|
|
|
|
+ set env(GDBHISTFILE) $old_gdbhistfile
|
|
|
|
+} else {
|
|
|
|
+ unset env(GDBHISTFILE)
|
|
|
|
+}
|
|
|
|
+if [info exists old_histsize] {
|
|
|
|
+ set env(HISTSIZE) $old_histsize
|
|
|
|
+} else {
|
|
|
|
+ unset env(HISTSIZE)
|
|
|
|
+}
|
|
|
|
+set timeout $oldtimeout1
|
|
|
|
+
|
2017-12-08 04:31:26 +00:00
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|