GNU bug report logs - #18140
[PATCH] macros.c: CHECK_VECTOR_OR_STRING invokes wrong_type_argument for Qnil instead of return 0

Previous Next

Package: emacs;

Reported by: Jan Chaloupka <jchaloup <at> redhat.com>

Date: Tue, 29 Jul 2014 05:03:02 UTC

Severity: normal

Tags: patch

Done: Andreas Schwab <schwab <at> suse.de>

Bug is archived. No further changes may be made.

Full log


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

From: Jan Chaloupka <jchaloup <at> redhat.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18140: [PATCH] macros.c: CHECK_VECTOR_OR_STRING invokes
 wrong_type_argument for Qnil instead of return 0
Date: Tue, 29 Jul 2014 10:23:52 +0200
On 07/29/2014 09:52 AM, Andreas Schwab wrote:
> Jan Chaloupka <jchaloup <at> redhat.com> writes:
>
>> Changelog:
>> 	line wrapping to 80 characters
>>
>> In function Fstart_kbd_macro (macros.c), Vlast_kbd_macro of current_kboard is
>> Qnil for the first invocation. If NILP (append) is false,
>> current_kboard->kbd_macro_ptr has random value (in our case
>> 0x5353535353535353), which after CHECK_VECTOR_OR_STRING failure (invocation
>> of wrong_type_argument) results in garbage collecting.
>> During gc, marking of objects is processed and mark_kboards (keyboard.c) is
>> invoked. Following for loop is fired:
>>
>> for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
>>                    mark_object (*p);
>>
>> Since kb->kbd_macro_ptr is set to 0x5353535353535353, mark_object (*p) is
>> trying to mark object on address out of memory space (or memory that
>> cannot be accessed). Thus resulting in SIGSEGV signal.
> So the correct solution is to initialize kbd_macro_ptr together with
> kbd_macro_buffer.  Otherwise the same situation can still happen any
> time garbage collection is called.
Yes, for garbage collector. However, Vlast_kbd_macro will continue being 
Qnil.
The patch is still valid (just without comment about random value of
kbd_macro_ptr and garbage collection):

In function Fstart_kbd_macro (macros.c), Vlast_kbd_macro of 
current_kboard is
Qnil for the first invocation. If NILP (append) is false
CHECK_VECTOR_OR_STRING fails (invocation
of wrong_type_argument resulting in emacs_abort). However, it has to pass.

> Andreas.
>





This bug report was last modified 10 years and 360 days ago.

Previous Next


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