all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 11442@debbugs.gnu.org
Subject: bug#11442: dbus uses Emacs integer as pointer, possible core dump
Date: Wed, 09 May 2012 17:35:49 +0200	[thread overview]
Message-ID: <87y5p1l63u.fsf@gmx.de> (raw)
In-Reply-To: <4FAA8B59.8050207@cs.ucla.edu> (Paul Eggert's message of "Wed, 09 May 2012 08:20:57 -0700")

Paul Eggert <eggert@cs.ucla.edu> writes:

Hi Paul,

> The trunk version of Emacs src/dbusbind.c contains a function
> xd_get_connection_address that does this:
>
>     connection = (DBusConnection *) (intptr_t) XFASTINT (val);
>
> This converts an Emacs integer to a pointer without checking
> that it is actually of the proper C type.  It is possible
> for Lisp code to mistakenly put an integer there that will
> cause Emacs to dump core.

In general, I agree with you. In the given case, it is just a pointer
address which has been written in Fdbus_init_bus. No other place is
expected to write such an address, but since it is a Lisp object,
somebody could do by mistake.

>  Shouldn't this be made safe, so that Lisp code can't do that?  For
> example, a DbusConnection * could be made a proper Lisp pseudovector
> or misc type or something like that.  The idea is to avoid a bad
> pointer leaking into the C code.

DbusConnection * is included by <dbus/dbus.h>; we cannot make it a
private type. But if there is something we could add as "glue type",
please do. I'm not so familar with Emacs' internal type armors.

Best regards, Michael.





  reply	other threads:[~2012-05-09 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 15:20 bug#11442: dbus uses Emacs integer as pointer, possible core dump Paul Eggert
2012-05-09 15:35 ` Michael Albinus [this message]
2012-05-09 15:45   ` Andreas Schwab
2012-05-09 21:19     ` Michael Albinus
2012-05-09 21:35       ` Paul Eggert

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

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

  git send-email \
    --in-reply-to=87y5p1l63u.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=11442@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.