From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26374 invoked by alias); 26 Sep 2017 08:06:06 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 8150 invoked by uid 89); 26 Sep 2017 08:05:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=BAYES_00,GIT_PATCH_2,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=stahl, Stahl, fwd, H*r:sk:gdb@sou X-HELO: mail-wm0-f51.google.com Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Sep 2017 08:05:46 +0000 Received: by mail-wm0-f51.google.com with SMTP id m127so4817289wmm.3 for ; Tue, 26 Sep 2017 01:05:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:references:to:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bPliISHjgkbdtFYVQ7ziVaO1IKWWD75W1JSptpj/+xg=; b=O9iyaWVu8O3IZBvjBuE9R2cwqOzv8X3zby9obu2WXxdlq7e/i7Jhw/AHXcE8Z+vHRC LfIUkedkMEW3jTqpmaLGb4aVCs76s8XaZCikhmI6mhjKVwZ6mlrnjvto3sUV02GHQlkO iVTs/F/d3e2YJQSw6fNiGbB+BUBM5RlkM66/2CFMJzr+crGkAXfT+OcegfHvXmtyJZaC axWevunyCoB3N9Rkh0W5qrcsk1rhjRO91N00AIs4Wsqc4d/1CuX3NCyf0vCJ6afqEEj7 99g5pwfClQkGQjOyRxRrF9jEqd21TVlYno6BglWArdQQsvqEvU5WIWSPAs7F1MwgABVQ OYNg== X-Gm-Message-State: AHPjjUiKiQVubgSvpS0Gmdu8hUdsJSpgom6DxBpgUQ39O/Ab5AurB5oQ jWQ8GyP0T/K4wirpFjCrz4mbUaZfkJg= X-Google-Smtp-Source: AOwi7QD0eUxu7b5Oc/ilbDIL6y/dSAWRfhEIuD7PxY72He/tfCPs6sxIwC1o7W3KAknyY+eZOyTc5g== X-Received: by 10.80.137.19 with SMTP id e19mr17108241ede.32.1506413144431; Tue, 26 Sep 2017 01:05:44 -0700 (PDT) Received: from ?IPv6:2a02:c7f:ae15:7800:4685:ff:fe66:9f4? ([2a02:c7f:ae15:7800:4685:ff:fe66:9f4]) by smtp.gmail.com with ESMTPSA id f27sm4791835edj.82.2017.09.26.01.05.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 01:05:42 -0700 (PDT) Subject: Fwd: Re: gdb 8.0 "lazy_string" exception "Length is larger than array size" References: To: gdb From: Phil Muldoon X-Forwarded-Message-Id: Message-ID: <73c9e4b9-91c8-95c1-1649-4b53dd7d88c8@redhat.com> Date: Tue, 26 Sep 2017 08:06:00 -0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00120.txt.bz2 Oops noticed original email was addressed to gdb@gnu.org. I don't think this is an alias for gdb@sourceware.org so forwarding my reply for completeness. Cheers Phil -------- Forwarded Message -------- Subject: Re: gdb 8.0 "lazy_string" exception "Length is larger than array size" Date: Tue, 26 Sep 2017 08:56:03 +0100 From: Phil Muldoon To: Michael Stahl , gdb@gnu.org, Doug Evans , Doug Evans On 25/09/17 18:20, Michael Stahl wrote: > > hi, > > for the following string type: > > /** The implementation of a Unicode string. > */ > typedef struct SAL_DLLPUBLIC_RTTI _rtl_uString > { > oslInterlockedCount refCount; /* opaque */ > sal_Int32 length; > sal_Unicode buffer[1]; > } rtl_uString; > > the gdb python pretty-printer calls: > > return data.lazy_string(encoding, length) > > full python pretty-printer module: > > https://gerrit.libreoffice.org/gitweb?p=core.git;a=blob;f=solenv/gdb/libreoffice/util/string.py;h=32583718f83b2ad5707f75dd6327d9aa62764439;hb=5f210715fe090b4db4c80dcdee5f77dc404cf85c#l56 > > now this results in this exception: > > Traceback (most recent call last): > File "/work/lo/master/solenv/gdb/libreoffice/util/string.py", line > 29, in to_string > return self.make_string(data, self.encoding, len) > File "/work/lo/master/solenv/gdb/libreoffice/util/string.py", line > 66, in make_string > return data.lazy_string(encoding, length) > gdb.error: Length is larger than array size. > > this is with Fedora 26 "GNU gdb (GDB) Fedora 8.0.1-26.fc26" - in Fedora > 25 this did not throw an exception. > > apparently the problem is that the array is statically declared as > "buffer[1]", however its actual dynamic size is the same as "length". > > is this a bug in gdb or is lazy_string not intended to support this > scenario? > > regards, > michael > Yeah, it's determining the string is an array and finding that the declared length is larger then the array size. This is (as you noted) the initial length of the array is [1] and that array is then modified later. This code was added at 34b433203b5 by Doug Evans and it was noted it was a bug. I've not sure, though, fixing this bug may have had unintended consequences. I've CC'd Doug on the patch and maybe he could comment further. Cheers Phil