From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: xnrealloc: How and when to properly use it. Date: Sat, 27 Apr 2019 21:50:17 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="95549"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 28 06:50:29 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hKblk-000OjQ-8l for ged-emacs-devel@m.gmane.org; Sun, 28 Apr 2019 06:50:28 +0200 Original-Received: from localhost ([127.0.0.1]:39771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKblj-0007Rk-8M for ged-emacs-devel@m.gmane.org; Sun, 28 Apr 2019 00:50:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKbld-0007Re-KE for emacs-devel@gnu.org; Sun, 28 Apr 2019 00:50:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hKblc-0007rU-8j for emacs-devel@gnu.org; Sun, 28 Apr 2019 00:50:21 -0400 Original-Received: from gateway24.websitewelcome.com ([192.185.50.252]:32178) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hKblb-0007r9-TG for emacs-devel@gnu.org; Sun, 28 Apr 2019 00:50:20 -0400 Original-Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 03EF78A29 for ; Sat, 27 Apr 2019 23:50:19 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id KblahmR3JiQerKblahSmiq; Sat, 27 Apr 2019 23:50:19 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=m94zXPqgSDWBH6KNrr5aSPY1L9535EpKfChaPUIMdHI=; b=HLZpBcCkFPsM1V/Mep9tvQ9Bjy 7/LOqYH4H9lHuFbDzzWS377l3R7ppX8YUKmBfeJp9Nt3niEkygfP8iXafWCN7V5OA5GlJBNPSqgdp DLkWWYu2+eLkFcYCEpRG2fNF25XSvcrxj6REfy8OrH22w897M8rLUPnSPY2u2qhN4lZE5OW9SFxGZ nMeWR2TOVG2K15O7hwojyWUQm0qUPNf8gK43cRkDkoagCCP0FwERi3nX9HYB5OAJowrjAcTlxKAUt nkGHD8oXx6Kij+IyWjkHfa+lw0GfWu/Chr7yy5kq1C0TEt+BIVdoKXPw134/q+EszXH6WATQH6tw5 oSnVYiSg==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:56908 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1hKbla-000KbO-9M; Sat, 27 Apr 2019 23:50:18 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1hKbla-000KbO-9M X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:56908 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.50.252 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235997 Archived-At: Thank you, Paul, for reviewing and responding to this particular thread. Based upon your suggestion, I set w->mc_elts.caches = xnrealloc ... and have thus far been unable to crash Emacs -- i.e., your suggestion appears to have resolved the issue. I'll do some additional testing tomorrow and report back. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > Date: [04-27-2019 18:51:51] <27 Apr 2019 18:51:51 -0700> > From: Paul Eggert > To: Keith David Bershatsky > Cc: Emacs Devel > Subject: Re: xnrealloc: How and when to properly use it. > > Keith David Bershatsky wrote: > > On a W32 build of Emacs (built with MinGW_32 and ezwinports downloaded a few years ago), my usage of xnrealloc (more often than not) causes Emacs to crash when_not_ running under gdb. > > Try the GDB command 'set disable-randomization off'. Of course this makes > debugging more ... interesting. > > + /* Decrease the size of the array to a bare minimum. */ > + xnrealloc (w->mc_elts.caches, 1, sizeof *w->mc_elts.caches); > > That can't be right; at the very least you need to assign the returned value of xnrealloc back to w->mc_elts.caches.