emacs-devel
[Top][All Lists]
Advanced

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

Re: Too permissive compare-strings?


From: Stefan Monnier
Subject: Re: Too permissive compare-strings?
Date: Tue, 24 Jun 2014 23:33:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> Surprisingly, I also found that current implementation of this
> function silently allows invalid ranges. E.g. this is not an error:

> (compare-strings "test" 0 100 "testbed" 0 4)

Indeed, this is used in string-prefix-p (a common use case for
compare-strings):

  (eq t (compare-strings str1 nil nil
                         str2 0 (length str1) ignore-case)))

With your semantics, we'd have to compare the lengths of str1 and str2
before calling compare-strings.

I think it's too late to "fix".


        Stefan



reply via email to

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