unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Chaloupka <jchaloup@redhat.com>
To: 18140@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <53D75A18.8000508@redhat.com> (raw)
In-Reply-To: <mvmk36wha9p.fsf@hawking.suse.de>


On 07/29/2014 09:52 AM, Andreas Schwab wrote:
> Jan Chaloupka <jchaloup@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.
>






  reply	other threads:[~2014-07-29  8:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140729053056.14713.45327.stgit@unused-4-157.brq.redhat.com>
2014-07-29  5:35 ` bug#18140: [PATCH] macros.c: CHECK_VECTOR_OR_STRING invokes wrong_type_argument for Qnil instead of return 0 Jan Chaloupka
2014-07-29  7:52   ` Andreas Schwab
2014-07-29  8:23     ` Jan Chaloupka [this message]
2014-07-29  8:37       ` Andreas Schwab
2014-07-29  8:55         ` Jan Chaloupka
2014-07-29  9:04           ` Andreas Schwab
2014-07-29  9:59             ` Jan Chaloupka
2014-07-29 10:05               ` Andreas Schwab
2014-07-29  8:10   ` Andreas Schwab
     [not found] <20140728103721.7115.54163.stgit@unused-4-157.brq.redhat.com>
2014-07-29  5:01 ` Jan Chaloupka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53D75A18.8000508@redhat.com \
    --to=jchaloup@redhat.com \
    --cc=18140@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).