emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subtle bugs in interval code.


From: Kim F. Storm
Subject: Subtle bugs in interval code.
Date: Fri, 23 Mar 2007 12:45:38 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux)

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 <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]