unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39047: macOS Catalina stack overflow patch
@ 2020-01-09  6:07 Väinö Järvelä
  2020-01-09 20:07 ` Alan Third
  0 siblings, 1 reply; 2+ messages in thread
From: Väinö Järvelä @ 2020-01-09  6:07 UTC (permalink / raw)
  To: 39047

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#39047: macOS Catalina stack overflow patch
  2020-01-09  6:07 bug#39047: macOS Catalina stack overflow patch Väinö Järvelä
@ 2020-01-09 20:07 ` Alan Third
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Third @ 2020-01-09 20:07 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: 39047-done

On Thu, Jan 09, 2020 at 08:07:23AM +0200, Väinö Järvelä wrote:
> 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.

Hi, this looks good. I did wonder if I was using the right type when I
wrote that code, but it seemed to work, anyway, thanks for spotting it.

Pushed to emacs-27 as 58412402959d8f88e230f95c5fc7de072e115140.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-09 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  6:07 bug#39047: macOS Catalina stack overflow patch Väinö Järvelä
2020-01-09 20:07 ` Alan Third

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).