unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: 27258@debbugs.gnu.org
Subject: bug#27258: 26.0.50; Possible undefined behavior in Fmapbacktrace
Date: Mon, 05 Jun 2017 20:13:37 +0000	[thread overview]
Message-ID: <CAArVCkQ86TupKsQzDneQUd9oh+BEDe3eUh3NLQ4=O_+t2g4REQ@mail.gmail.com> (raw)
In-Reply-To: <m21sqymcvj.fsf@p>

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

Philipp <p.stephani2@gmail.com> schrieb am Mo., 5. Juni 2017 um 21:51 Uhr:

>
> Insert the following into /tmp/rec.el:
>
> ;; -*- lexical-binding: t; -*-
>
> (require 'cl-lib)
>
> (defun recurse (i g)
>   (if (= i 0)
>       (funcall g (cl-gensym))
>     (recurse (1- i) g)))
>
> (recurse 100 (lambda (sym)
>                (message "outer: %s" sym)
>                (mapbacktrace
>                 (lambda (_ _ args _)
>                   (recurse 100 (lambda (sym)
>                                  (message "inner: %s %s" sym args)))))))
>
> Then run
>
>   emacs -Q -batch -l /tmp/rec.el
>
> The printed messages will either be way too short, or Emacs will
> segfault.  Re-running the command a couple of times consistently
> generated a segfault for me.
>
> My guess is that pdlvec got reallocated, but Fmapbacktrace uses pointers
> instead of indices to access its element, so they pointers became
> invalidated and point to garbage.


Fixed with commit 3d9d976aa476b1c1098359a1215ad1cabd022d33.

[-- Attachment #2: Type: text/html, Size: 1464 bytes --]

  reply	other threads:[~2017-06-05 20:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 19:51 bug#27258: 26.0.50; Possible undefined behavior in Fmapbacktrace Philipp
2017-06-05 20:13 ` Philipp Stephani [this message]
2017-06-05 20:14   ` Philipp Stephani

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='CAArVCkQ86TupKsQzDneQUd9oh+BEDe3eUh3NLQ4=O_+t2g4REQ@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=27258@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).