From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcus Karlsson Newsgroups: gmane.emacs.bugs Subject: bug#16683: 24.3; Crash on OS X when loading a bad PPM image Date: Sun, 9 Feb 2014 23:30:08 +0100 Organization: Academic Computer Club =?UTF-8?Q?Ume=C3=A5?= University Message-ID: <20140209223000.GA32384@hirohito.acc.umu.se> References: <1864A71D-D864-46CA-9219-73616E12652D@ravenbrook.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="gKMricLos+KVdGMg" X-Trace: ger.gmane.org 1391994016 9636 80.91.229.3 (10 Feb 2014 01:00:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Feb 2014 01:00:16 +0000 (UTC) Cc: 16683@debbugs.gnu.org To: Gareth Rees Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 10 02:00:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WCfEV-0000As-AB for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 02:00:23 +0100 Original-Received: from localhost ([::1]:52711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCfEU-0006Ln-R5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Feb 2014 20:00:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCfEK-0006Lf-B1 for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 20:00:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCfEB-00022M-TI for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 20:00:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCfEB-00021S-RF for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 20:00:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WCfEB-0006K8-Bi for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 20:00:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Marcus Karlsson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Feb 2014 01:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16683 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.139199396424224 (code B ref -1); Mon, 10 Feb 2014 01:00:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Feb 2014 00:59:24 +0000 Original-Received: from localhost ([127.0.0.1]:32856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCfDX-0006Ib-CT for submit@debbugs.gnu.org; Sun, 09 Feb 2014 19:59:24 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57411) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCctg-0005DB-8C for submit@debbugs.gnu.org; Sun, 09 Feb 2014 17:30:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCctX-0006uT-GE for submit@debbugs.gnu.org; Sun, 09 Feb 2014 17:30:43 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCctX-0006uP-1C for submit@debbugs.gnu.org; Sun, 09 Feb 2014 17:30:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCctR-0007uU-0V for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 17:30:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCctL-0006sl-0P for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 17:30:28 -0500 Original-Received: from mail.acc.umu.se ([130.239.18.156]:62334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCctK-0006sb-P2 for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 17:30:22 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by amavisd-new (Postfix) with ESMTP id D559D92B; Sun, 9 Feb 2014 23:30:19 +0100 (MET) X-Virus-Scanned: amavisd-new at acc.umu.se Original-Received: from hirohito.acc.umu.se (hirohito.acc.umu.se [IPv6:2001:6b0:e:2018::140]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mk) by mail.acc.umu.se (Postfix) with ESMTPSA id 3AF4B92A; Sun, 9 Feb 2014 23:30:15 +0100 (MET) Content-Disposition: inline In-Reply-To: <1864A71D-D864-46CA-9219-73616E12652D@ravenbrook.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sun, 09 Feb 2014 19:59:22 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:85117 Archived-At: --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 07, 2014 at 01:53:14PM +0000, Gareth Rees wrote: > Emacs for Mac OS X crashes when trying to display a badly formatted > PPM image. The crash is 100% reproducible. I'm able to reproduce this crash on the current head. My impression after running it through the debugger is that -release is called on the pixmap after it has been deallocated earlier in pbm_load. I have created a patch that sets the pixmap to NO_PIXMAP in case pbm_load runs into an error. In the long run the better solution is probably to look over the NS memory management so that it works properly. Marcus --gKMricLos+KVdGMg Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="16683-fix.patch" diff --git a/src/image.c b/src/image.c index 706745f..e53ad0b 100644 --- a/src/image.c +++ b/src/image.c @@ -5215,6 +5215,7 @@ pbm_load (struct frame *f, struct image *img) image_error ("Not a PBM image: `%s'", img->spec, Qnil); error: xfree (contents); + img->pixmap = NO_PIXMAP; return 0; } --gKMricLos+KVdGMg--