From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85313 invoked by alias); 17 May 2019 15:34:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 85304 invoked by uid 89); 17 May 2019 15:34:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=capabilities, terminals, besides X-HELO: mpv3-2015.case.edu Received: from mpv3-2015.CWRU.Edu (HELO mpv3-2015.case.edu) (129.22.103.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 May 2019 15:34:45 +0000 Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234]) by mpv3-2015.case.edu (MOS 4.4.8-GA FastPath queued) with ESMTP id AXS72703; Fri, 17 May 2019 11:34:39 -0400 (EDT) Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211]) by mpv5-2015.case.edu (MOS 4.4.8-GA FastPath queued) with ESMTP id CRP75839 (AUTH cpr); Fri, 17 May 2019 11:34:38 -0400 (EDT) Reply-To: chet.ramey@case.edu Cc: chet.ramey@case.edu, gdb-patches@sourceware.org, Pedro Alves Subject: Re: [Bug-readline] heap-buffer-overflow in update_line To: Tom de Vries , bug-readline@gnu.org References: <52f237e9-83e8-2a97-4766-e60b867ab914@suse.de> <79173bd4-f37e-c137-cf48-187047078bf0@suse.de> From: Chet Ramey Openpgp: preference=signencrypt Message-ID: <00bafa96-d8ca-cb30-c6c3-618f2563446b@case.edu> Date: Fri, 17 May 2019 15:34:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <79173bd4-f37e-c137-cf48-187047078bf0@suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Junkmail-PrAS-Raw: score=10/90, refid=2.7.2:2019.5.17.143916:17:10.433, ip=, rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2, __CC_NAME, __CC_NAME_DIFF_FROM_ACC, __SUBJ_REPLY, __PHISH_SPEAR_SUBJ_PREDICATE, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2, __TO_IN_SUBJECT2, __REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 X-SW-Source: 2019-05/txt/msg00427.txt.bz2 On 5/17/19 10:59 AM, Tom de Vries wrote: > > I've tried this: > ... > diff --git a/gdb/utils.c b/gdb/utils.c > index 9686927473..2bfa22055e 100644 > --- a/gdb/utils.c > +++ b/gdb/utils.c > @@ -1371,7 +1371,7 @@ set_screen_size (void) > > if (cols <= 0 || cols > sqrt_int_max) > { > - cols = sqrt_int_max; > + cols = -1; > chars_per_line = UINT_MAX; > } It's not apparent from this patch whether or not gdb uses `cols' for anything besides passing to readline. > ... > but ran into this test failure in gdb.ada/pp-rec-component.exp: > ... > (gdb) source > /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/pp^M > ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hrec-component/pp-rec-com > ^M ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Honent.py^M > (gdb) FAIL: gdb.ada/pp-rec-component.exp: source pp-rec-component.py > ... > which is readline doing it's horizontal scrolling mode, which AFAIU is > triggered by this condition in rl_redisplay failing: > ... > if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) > ... > not because _rl_horizontal_scroll_mode is 1, but because _rl_term_up is > NULL (because of TERM=dumb). Correct. If the terminal type is unknown or tgetent returns a set of capabilities that doesn't include "up", you're going to get horizontal scrolling. > > Note btw that ^H is used here by readline despite the fact that > TERM=dumb does not support backspace. I'm not sure if this is a bug, or > intentional behaviour. Readline uses what tgetent returns for "le" or defaults to "\b" if tgetent fails. Most dumb terminals support ^H to move the cursor left one position. > > Either way, I'm open for suggestions that make gdb call > rl_set_screen_size with legal parameters, and disable features like > horizontal scrolling to get unformatted output for the testsuite run. You can't specify a dumb terminal and expect to have line wrapping. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/