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