From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12594 invoked by alias); 25 Nov 2013 23:55:26 -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 12583 invoked by uid 89); 25 Nov 2013 23:55:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ie0-f174.google.com Received: from Unknown (HELO mail-ie0-f174.google.com) (209.85.223.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 25 Nov 2013 23:55:24 +0000 Received: by mail-ie0-f174.google.com with SMTP id at1so8002073iec.33 for ; Mon, 25 Nov 2013 15:55:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=4v+N+K08vd+zbezBXmFM7F1D0o3xDanZOYt1Wi0qixI=; b=ide65LQ446A3SBsy9A7UwIHZuVAbgtXQJcJByJBPNb/Tafz9FAFWDOjoCSxaUdr6N8 toGeV+QpU//jdBsQ3E/zrUeDgn9rNst2vWe9lqVNeCkgZOE1e55vm+51nLOIOfVWcR8Q oYdq4tAWW5t0j/xYWEinms58JP6XoIn2j7rHc3AR2/O3Xn2eCyBsB4YtZpV/mlu9xu0r XVLPPhpDoi4BLX1R4hSgf5L8sbxZa5cpkMiOXqccolT5kOc+6F1P0xcW0l3DlTOU38o3 Bdnd9NN7Z7oBqvVjk+d0Eo8ZWqlQm/HtQSCWX3t7IYH+v/V8MkBPMKx2eHtkkwQC2z0i gAVQ== X-Gm-Message-State: ALoCoQnG5+nDz3x6BgWpyxFwPV4HZyxIEdUUUGG1qzgtPnh/ndoAGstlpAM2ZadK+29wDaubiDhj5LvvIudJOLeyPnoG33XGs7tNkdWxeiZl42zGpbz35OefRaW7Nhv7QKX+Noojlv2Qo2CKjBWyGVmlA6EWpJohQaLXbdTo5bzOapnu+oF/Vc/FDxdUhbohKdQ2+qawd1MdZ3B09slD8Mkga3sHHkyhhA== MIME-Version: 1.0 X-Received: by 10.50.45.73 with SMTP id k9mr14858823igm.38.1385423716988; Mon, 25 Nov 2013 15:55:16 -0800 (PST) Received: by 10.64.18.200 with HTTP; Mon, 25 Nov 2013 15:55:16 -0800 (PST) In-Reply-To: References: Date: Tue, 26 Nov 2013 02:58:00 -0000 Message-ID: Subject: Re: Fix for pr16196: Honor fetch limit for strings of known size From: Sterling Augustine To: Doug Evans Cc: gdb-patches Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2013-11/txt/msg00796.txt.bz2 On Fri, Nov 22, 2013 at 12:35 PM, Doug Evans wrote: > On Fri, Nov 22, 2013 at 12:02 PM, Sterling Augustine > wrote: >> The enclosed patch fixes 16196, which was revealed when an unitialized >> C++ string happened to point to valid memory and had a garbage in the >> size field that happened to look very large. GDB then spins a very >> long time reading invalid memory. >> >> The patch fixes this by enforcing the fetch limit (which, in turn, is >> set by print elements) even when the size of the string is known. This >> makes the function's behavior similar to when the size of the string >> isn't know. >> >> I checked all callers, and it this does not cause any difference in >> behavior, and reveals no new problems in the test-suite. >> >> Thanks >> >> Sterling >> >> 2013-11-22 Sterling Augustine >> >> PR backtrace/16196: >> * valprint.c (read_string): Set new variable fetchlen based on >> fetchlimit and size. Use it in call to partial_memory_read. >> Update comment. > > LGTM. > [There are still other issues, but this patch doesn't have to fix all of them.] > > I'd change the "backtrace" in backtrace/16196 to something else, not > sure what though. > "gdb" is always a good fallback. PR gdb/16196. Checked in with the minor ChangeLog fix as requested.