unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Väinö Järvelä" <vaino@jarve.la>
To: 39047@debbugs.gnu.org
Subject: bug#39047: macOS Catalina stack overflow patch
Date: Thu, 9 Jan 2020 08:07:23 +0200	[thread overview]
Message-ID: <CAMXH_UrYsaQ1aTfMAjCO-gYTxHduNSc0Sy-8heDbZfBHouvQig@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

Hi,

After updating to macOS Catalina, Emacs started crashing when opening
any file, even a file that doesn't exist.

I traced it to a stack overflow from a fix to bug #38618 (commit
bfc54230). A fix for the bug is included.

-- 
Väinö

[-- Attachment #2: 0001-Fix-stack-overflow-on-macOS-Catalina.patch --]
[-- Type: application/octet-stream, Size: 1276 bytes --]

From c83cd49fa166ab87276146939eaf8ee3e0fd9a07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A4in=C3=B6=20J=C3=A4rvel=C3=A4?= <vaino@jarve.la>
Date: Thu, 9 Jan 2020 08:01:59 +0200
Subject: [PATCH] Fix stack overflow on macOS Catalina

NSURL.getResourceValue:forKey:error: for key NSURLIsUbiquitousItemKey
writes an NSNumber to the pointer, not a BOOL. This results in a stack
overflow that can be reproduced on macOS Catalina when opening any file
with ns-use-proxy-icon enabled.
---
 src/nsfns.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index f2857c022e..42bd88eeb4 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -499,11 +499,11 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
 #if defined (NS_IMPL_COCOA) && defined (MAC_OS_X_VERSION_10_7)
   /* Work around for Mach port leaks on macOS 10.15 (bug#38618).  */
   NSURL *fileURL = [NSURL fileURLWithPath:fstr isDirectory:NO];
-  BOOL isUbiquitousItem = YES;
+  NSNumber *isUbiquitousItem = @YES;
   [fileURL getResourceValue:(id *)&isUbiquitousItem
                      forKey:NSURLIsUbiquitousItemKey
                       error:nil];
-  if (isUbiquitousItem)
+  if ([isUbiquitousItem boolValue])
     fstr = @"";
 #endif
 
-- 
2.24.1


             reply	other threads:[~2020-01-09  6:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09  6:07 Väinö Järvelä [this message]
2020-01-09 20:07 ` bug#39047: macOS Catalina stack overflow patch Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMXH_UrYsaQ1aTfMAjCO-gYTxHduNSc0Sy-8heDbZfBHouvQig@mail.gmail.com \
    --to=vaino@jarve.la \
    --cc=39047@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).