From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Chaloupka Newsgroups: gmane.emacs.bugs 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 Message-ID: <53D75A18.8000508@redhat.com> References: <20140729053056.14713.45327.stgit@unused-4-157.brq.redhat.com> <53D73287.6020406@redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1406622336 19534 80.91.229.3 (29 Jul 2014 08:25:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2014 08:25:36 +0000 (UTC) To: 18140@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 29 10:25:26 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XC2is-0001Ah-30 for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Jul 2014 10:25:26 +0200 Original-Received: from localhost ([::1]:44173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC2ir-0003CM-H6 for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Jul 2014 04:25:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC2ie-0003B8-7W for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:25:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC2iV-0007jK-5G for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:25:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC2iV-0007jB-2T for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XC2iU-0007xv-I3 for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan Chaloupka Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Jul 2014 08:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18140 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.140662226630572 (code B ref -1); Tue, 29 Jul 2014 08:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Jul 2014 08:24:26 +0000 Original-Received: from localhost ([127.0.0.1]:41597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC2ht-0007x0-SP for submit@debbugs.gnu.org; Tue, 29 Jul 2014 04:24:26 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44112) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC2hp-0007wl-QW for submit@debbugs.gnu.org; Tue, 29 Jul 2014 04:24:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC2hb-0007ac-Ld for submit@debbugs.gnu.org; Tue, 29 Jul 2014 04:24:16 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC2hb-0007aY-Id for submit@debbugs.gnu.org; Tue, 29 Jul 2014 04:24:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC2hV-00031Y-D2 for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:24:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC2hP-0007Z7-85 for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:24:01 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:48490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC2hO-0007Yz-V6 for bug-gnu-emacs@gnu.org; Tue, 29 Jul 2014 04:23:55 -0400 Original-Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6T8NsXE014248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 29 Jul 2014 04:23:54 -0400 Original-Received: from unused-4-157.brq.redhat.com (unused-4-228.brq.redhat.com [10.34.4.228]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6T8NrWM004835 for ; Tue, 29 Jul 2014 04:23:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91919 Archived-At: On 07/29/2014 09:52 AM, Andreas Schwab wrote: > Jan Chaloupka 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. >