GNU bug report logs - #79156
igc: igc_xpalloc_ambig SEGV

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Sat, 2 Aug 2025 15:28:01 UTC

Severity: normal

Fixed in version 31.1

Done: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Full log


View this message in rfc822 format

From: Pip Cet <pipcet <at> protonmail.com>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, eller.helmut <at> gmail.com, 79156 <at> debbugs.gnu.org
Subject: bug#79156: igc: igc_xpalloc_ambig SEGV
Date: Sun, 03 Aug 2025 13:13:45 +0000
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
>> Pip Cet <pipcet <at> protonmail.com> writes:
>>
>>> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>>>
>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>>>
>>>>>> Ouch. That seems to me to be a bug in how charset.c calls xpalloc, but
>>>>>> I'm not sure whether there are other callers that rely on this behavior,
>>>>>> so it's safest to work around it.
>>>>>
>>>>> xpalloc handles this case:
>>>>>
>>>>>   if (! pa)
>>>>>     *nitems = 0;
>>>>
>>>> Yeah, I'd rather check the other igc variants of xpalloc, to make sure
>>>> they are compatible with the original, even if no one else uses that
>>>> particular feature.
>>>
>>> That's what I did, I think?
>>>
>>> The code above doesn't have any effect unless we run out of memory (even
>>> then, it won't have an effect if NITEMS is a stack variable in a frame
>>> that's unwound by memory_full).
>>
>> Sorry, I'm currently to unconcentrated to follow. I just wanted to say
>> that it would be good to make the functions are compatible with xpalloc,
>> whatever that means.
>
> Do you want me to look at your patch? I'd rather just rely on you,
> though :-).

Pushed now. Can you confirm it works and close this bug?

> And while everyone is on board: I was making emacs-mac use igc
> in my Emacs. Seems to have worked, I'm writing this from
>
>   ELISP> (and (featurep 'mac) (featurep 'mps))
>   t
>
> Only minimal additions to igc.[ch] were necessary because mac uses a
> Lisp and a GUI thread, and so on, so I couldn't use init_igc for mac.
> Two new functions in äifdef HAVE_MAC_GUI instead, igc_init_mac_early and
> _late.

That sounds like an acceptable price to support macOS better. I don't
use macOS, though, so I can't really say anything about the two ports
and their differences.

Pip





This bug report was last modified 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.