Subject: Re: bug#41184: 28.0.50; Crash on NS when opening text file in a possibly invalid zip archive

From: Eli Zaretskii <[email-masked]>
Date: Mon, 11 May 2020 21:53:49 +0300

> From: Andrii Kolomoiets <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 11 May 2020 21:46:38 +0300
> 
> >> 4   AppKit                              0x00007fff2fe991c4 -[NSWindow setTitle:] + 185
> >> 5   Emacs-x86_64-10_14                  0x000000010b22dfb1 ns_set_name_internal + 161
> >> 6   Emacs-x86_64-10_14                  0x000000010b227e8b ns_implicitly_set_name + 475
> >> 7   Emacs-x86_64-10_14                  0x000000010b08a531 gui_consider_frame_title + 609
> >
> > Looks like some NS-specific issue with showing a strange file name in
> > the frame title?
> 
> You are absolutely right.
> 
> Actually crash can be reproduced with single step:
> 
>   (set-frame-name "\200")

It probably means the APIs used by ns_set_name_internal cannot handle
invalid UTF-8 sequences.  The code there seems to naïvely encode in
UTF-8, but doesn't have any error handling for when that fails.
Someone who knows about NS programming should add some simple
workaround, like showing a string "\200" instead of a byte \200.
Or something.