all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
To: emacs-devel@gnu.org
Subject: Subtle bugs in interval code.
Date: Fri, 23 Mar 2007 12:45:38 +0100	[thread overview]
Message-ID: <m3lkhoi3od.fsf@kfs-l.imdomain.dk> (raw)


Studying the code in interval.c for merge_properties and
intervals_equal, I noticed that they use Fmemq to search
for a given property on a plist.

That's not a safe way to do that;

E.g. consider a plist like this:

(setq p '(a b c d))

Now,

 (plist-get p 'a) => b
 (plist-get p 'b) => nil

whereas

 (memq 'a p) => (a b c d)
 (memq 'b p) => (b c d)   !=   nil

So due to the use of Fmemq, the interval code may wrongly assume that
the plist has a `b' member with a value of `c'.

I'm not aware of any specific bugs related to this.

Note that we cannot just use plist-get instead of memq, as we then
cannot differentiate between "property is on list with nil value"
and "property is not on list".

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

             reply	other threads:[~2007-03-23 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-23 11:45 Kim F. Storm [this message]
2007-03-23 11:55 ` Subtle bugs in interval code David Kastrup
2007-03-23 14:03   ` Kim F. Storm
2007-03-23 14:59 ` Johan Bockgård
2007-03-23 15:42   ` Kim F. Storm
2007-03-23 22:32 ` Richard Stallman
2007-03-25  1:19   ` Kim F. Storm
2007-03-25 17:27     ` Richard Stallman
2007-03-25 22:47       ` Kim F. Storm

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=m3lkhoi3od.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@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 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.