From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Avoid expect's buffer overflow in info-var.exp test.
Date: Sat, 31 Aug 2019 19:04:00 -0000 [thread overview]
Message-ID: <20190831190424.GZ6076@embecosm.com> (raw)
In-Reply-To: <20190831153656.6439-1-philippe.waroquiers@skynet.be>
* Philippe Waroquiers <philippe.waroquiers@skynet.be> [2019-08-31 17:36:56 +0200]:
> Once the executable is started, info variables can show thousands
> of variables belonging to glibc (see below).
>
> This long list of variables then causes the test to fail, due
> to expect's buffer overflow:
> Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ...
> ERROR: internal buffer is full.
> ERROR: internal buffer is full.
> ERROR: internal buffer is full.
>
> Fix this by running testing 'info variables' without running the
> executable.
>
> gdb ./info-var
> ...
> Reading symbols from ./info-var...
> (gdb) |info variables|wc
> 27 54 971
> (gdb) start
> Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23.
> Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var
>
> Temporary breakpoint 1, main ()
> at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23
> 23 return global_var + get_offset() + f1_var;
> (gdb) |info variables|wc
> 4334 14581 130738
> (gdb)
>
> gdb/testsuite/ChangeLog
> YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> * gdb.base/info-var.exp: Test info variables without running
> to main, to avoid expect's buffer overflow.
Seems reasonable to me.
Thanks,
Andrew
> ---
> gdb/testsuite/gdb.base/info-var.exp | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/info-var.exp b/gdb/testsuite/gdb.base/info-var.exp
> index 6dd896d8aa..c9b7485ffb 100644
> --- a/gdb/testsuite/gdb.base/info-var.exp
> +++ b/gdb/testsuite/gdb.base/info-var.exp
> @@ -22,10 +22,9 @@ if {[prepare_for_testing "failed to prepare" \
> return -1
> }
>
> -if ![runto_main] then {
> - fail "can't run to main"
> - return 0
> -}
> +# Note: we do not run to main, as otherwise, the output of info variables
> +# can be very long, showing thousands of glibc variables.
> +# This long output then causes expect's buffer to overflow.
>
> gdb_test "info variables" \
> [multi_line \
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-08-31 19:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-31 15:37 Philippe Waroquiers
2019-08-31 19:04 ` Andrew Burgess [this message]
2019-09-04 20:42 ` Philippe Waroquiers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190831190424.GZ6076@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox