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