all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Subtle bugs in interval code.
@ 2007-03-23 11:45 Kim F. Storm
  2007-03-23 11:55 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kim F. Storm @ 2007-03-23 11:45 UTC (permalink / raw)
  To: emacs-devel


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-03-25 22:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-23 11:45 Subtle bugs in interval code Kim F. Storm
2007-03-23 11:55 ` 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

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.