Blame SOURCES/gdb-6.5-readline-long-line-crash-test.patch

7a6771
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
7a6771
7a6771
7a6771
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/readline-overflow.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/readline-overflow.exp	2016-02-15 23:30:29.191677414 +0100
7a6771
@@ -0,0 +1,126 @@
7a6771
+# Copyright 2006 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
7a6771
+
7a6771
+# Please email any bugs, comments, and/or additions to this file to:
7a6771
+# bug-gdb@prep.ai.mit.edu
7a6771
+
7a6771
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
7a6771
+
7a6771
+# This file is part of the gdb testsuite.
7a6771
+
7a6771
+#
7a6771
+# Tests for readline buffer overflow.
7a6771
+#
7a6771
+
7a6771
+if $tracelevel {
7a6771
+  strace $tracelevel
7a6771
+}
7a6771
+
7a6771
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
7a6771
+# the test results.  Even if /dev/null doesn't exist on the particular
7a6771
+# platform, the readline library will use the default setting just by
7a6771
+# failing to open the file.  OTOH, opening /dev/null successfully will
7a6771
+# also result in the default settings being used since nothing will be
7a6771
+# read from this file.
7a6771
+global env
7a6771
+if [info exists env(INPUTRC)] {
7a6771
+    set old_inputrc $env(INPUTRC)
7a6771
+}
7a6771
+set env(INPUTRC) "/dev/null"
7a6771
+
7a6771
+set oldtimeout1 $timeout
7a6771
+set timeout 600
7a6771
+
7a6771
+if [info exists env(GDBHISTFILE)] {
7a6771
+    set old_gdbhistfile $env(GDBHISTFILE)
7a6771
+}
7a6771
+if [info exists env(HISTSIZE)] {
7a6771
+    set old_histsize $env(HISTSIZE)
7a6771
+}
7a6771
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
7a6771
+set env(HISTSIZE) "10"
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+
7a6771
+
7a6771
+set width 11
7a6771
+gdb_test "set width $width" \
7a6771
+         "" \
7a6771
+         "Setting width to $width."
7a6771
+#gdb_test "set height 1" \
7a6771
+#         "" \
7a6771
+#         "Setting height to 1."
7a6771
+send_gdb "run X"
7a6771
+set i 0
7a6771
+# It crashes using `set width 7' on `set total 3560'.
7a6771
+# Sometimes it corrupts screen on `set width 7'.
7a6771
+# Bugreport used `set total 130001':
7a6771
+# 	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
7a6771
+# Check also `timeout' above.
7a6771
+set total 4200
7a6771
+gdb_expect {
7a6771
+	-re X {
7a6771
+		incr i
7a6771
+		if {$i <= $total} {
7a6771
+			send_gdb "X"
7a6771
+			exp_continue
7a6771
+		}
7a6771
+	}
7a6771
+	-re "\[ \b\r\n\]" {
7a6771
+		exp_continue
7a6771
+	}
7a6771
+	eof {
7a6771
+		fail "gdb sending total $total characters"
7a6771
+		note "Failed after sending $i characters, reason: EOF"
7a6771
+		gdb_clear_suppressed
7a6771
+	}
7a6771
+	timeout {
7a6771
+		fail "gdb sending total $total characters"
7a6771
+		note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
7a6771
+		gdb_clear_suppressed
7a6771
+	}
7a6771
+	default {
7a6771
+		fail "gdb sending total $total characters"
7a6771
+		note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
7a6771
+		gdb_clear_suppressed
7a6771
+	}
7a6771
+}
7a6771
+send_gdb "\r"
7a6771
+gdb_test "" \
7a6771
+         "No executable file specified..*" \
7a6771
+         "All the characters transferred"
7a6771
+
7a6771
+
7a6771
+# Restore globals modified in this test...
7a6771
+if [info exists old_inputrc] {
7a6771
+    set env(INPUTRC) $old_inputrc
7a6771
+} else {
7a6771
+    unset env(INPUTRC)
7a6771
+}
7a6771
+if [info exists old_gdbhistfile] {
7a6771
+    set env(GDBHISTFILE) $old_gdbhistfile
7a6771
+} else {
7a6771
+    unset env(GDBHISTFILE)
7a6771
+}
7a6771
+if [info exists old_histsize] {
7a6771
+    set env(HISTSIZE) $old_histsize
7a6771
+} else {
7a6771
+    unset env(HISTSIZE)
7a6771
+}
7a6771
+set timeout $oldtimeout1
7a6771
+