GNU bug report logs - #25684
25.1; (downcase -1) segfaults Emacs on GNU/Linux

Previous Next

Package: emacs;

Reported by: Wilfred Hughes <me <at> wilfred.me.uk>

Date: Sat, 11 Feb 2017 00:03:02 UTC

Severity: normal

Found in version 25.1

Fixed in version 26.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 25684 <at> debbugs.gnu.org (full text, mbox):

From: Wilfred Hughes <me <at> wilfred.me.uk>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 25684 <at> debbugs.gnu.org
Subject: Re: bug#25684: 25.1; (downcase -1) segfaults Emacs on GNU/Linux
Date: Wed, 15 Feb 2017 22:48:49 +0000
When I tested it on OS X, (downcase -1) returned -1.

I agree with Glenn that I think the most sensible behaviour would be
to signal a type error. I don't believe the manual specifies this
behaviour: https://www.gnu.org/software/emacs/manual/html_node/elisp/Case-Conversion.html
so it's unlikely users depend on this.

On 14 February 2017 at 15:04, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> On Feb 13 2017, Glenn Morris <rgm <at> gnu.org> wrote:
>
>> Wilfred Hughes wrote:
>>
>>> The elisp primitives downcase and upcase cause Emacs to segfault when
>>> given a negative argument. For example, (downcase -1).
>>>
>>> I can reproduce this on Emacs 25.1 as well as on master. It occurs on
>>> GNU/Linux but not on OS X.
>>
>> I can't reproduce this, but it seems to me that (downcase -1) should
>> signal a wrong-type-argument error, since negative numbers are not characters.
>> But I think there are probably subtleties here that I don't get.
>
> The function uses XFASTINT, which only works for non-negative numbers.
> This is checked when runtime checking is enabled.
>
> Andreas.
>
> --
> Andreas Schwab, schwab <at> linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."




This bug report was last modified 8 years and 97 days ago.

Previous Next


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