emacs-devel
[Top][All Lists]
Advanced

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

Too permissive compare-strings?


From: Dmitry Antipov
Subject: Too permissive compare-strings?
Date: Tue, 24 Jun 2014 18:03:16 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Recently I tried to utilize the common substring range validation
function validate_subarray in Fcompare_strings (patch is attached).
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)

Although 100 is invalid, this is 't'. Compare it with substring:

(substring "test" 0 100) ==> not "test", but Args out of range: "test", 0, 100

Not too serious problem? Wrong. A lot of existing Lisp code assumes
current semantic of compare-strings and tends to specify range end which is
beyond the end of string. After applying my patch, I was unable to bootstrap,
with a lot of errors from lisp/subr.el and lisp/files.el.

Thoughts?

Dmitry

Attachment: compare_strings.patch
Description: Text Data


reply via email to

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