Ar an t-aonú lá is triochad de mí Lúnasa, scríobh Henry S. Thompson:
OK, last message on this topic -- it's not wildly implausible
that
this is a new, previously undetected, bug, as the relevant code was
only added 4 months ago:
changeset: 5648:3f4a234f4672
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Apr 21 18:58:28 2012 +0100
summary: Support non-ASCII correctly in character classes, test this.
It was indeed. Thank you Henry!
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1346603807 -3600
# Node ID 8a2ac78cb97d31a39208d1c6c5081477daac61eb
# Parent a81a739181dce8c6705bddd92047b210b95abb0c
Pre-emptively update any dirty mirror syntax table before searching
src/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea(a)parhasard.net>
* regex.c (re_search_2):
* regex.c (re_match_2):
If the mirror syntax table is dirty, update it before the search,
preventing a malloc() inside the search code, something which
isn't allowed. Thank you Henry Thompson!
tests/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/regexp-tests.el:
Make sure we can search for character ranges successfully when the
syntax table is dirty.
diff -r a81a739181dc -r 8a2ac78cb97d src/ChangeLog
--- a/src/ChangeLog Sun Sep 02 14:31:40 2012 +0100
+++ b/src/ChangeLog Sun Sep 02 17:36:47 2012 +0100
@@ -1,3 +1,11 @@
+2012-09-02 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * regex.c (re_search_2):
+ * regex.c (re_match_2):
+ If the mirror syntax table is dirty, update it before the search,
+ preventing a malloc() inside the search code, something which
+ isn't allowed. Thank you Henry Thompson!
+
2012-08-12 Aidan Kehoe <kehoea(a)parhasard.net>
* specifier.c (define_specifier_tag):
diff -r a81a739181dc -r 8a2ac78cb97d src/regex.c
--- a/src/regex.c Sun Sep 02 14:31:40 2012 +0100
+++ b/src/regex.c Sun Sep 02 17:36:47 2012 +0100
@@ -4663,6 +4663,7 @@
#ifdef emacs
BEGIN_REGEX_MALLOC_OK ();
+ update_mirror_syntax_if_dirty (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf));
scache = setup_syntax_cache (scache, lispobj, lispbuf,
offset_to_charxpos (lispobj, startpos),
1);
@@ -5052,6 +5053,10 @@
int result;
#ifdef emacs
+ /* Update the mirror syntax table if it's dirty now, this would otherwise
+ cause a malloc() in charset_mule in re_match_2_internal() when checking
+ characters' syntax. */
+ update_mirror_syntax_if_dirty (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf));
scache = setup_syntax_cache (scache, lispobj, lispbuf,
offset_to_charxpos (lispobj, pos),
1);
diff -r a81a739181dc -r 8a2ac78cb97d tests/ChangeLog
--- a/tests/ChangeLog Sun Sep 02 14:31:40 2012 +0100
+++ b/tests/ChangeLog Sun Sep 02 17:36:47 2012 +0100
@@ -1,3 +1,9 @@
+2012-09-02 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/regexp-tests.el:
+ Make sure we can search for character ranges successfully when the
+ syntax table is dirty.
+
2012-08-02 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.32 "habanero" is released.
diff -r a81a739181dc -r 8a2ac78cb97d tests/automated/regexp-tests.el
--- a/tests/automated/regexp-tests.el Sun Sep 02 14:31:40 2012 +0100
+++ b/tests/automated/regexp-tests.el Sun Sep 02 17:36:47 2012 +0100
@@ -1109,3 +1109,11 @@
(decode-char 'ucs #x2116) ;; NUMERO SIGN
(decode-char 'ucs #x5357))) ;; kDefinition south; southern part; southward
+(with-temp-buffer
+ (insert "hi there")
+ (goto-char 1)
+ (set-syntax-table (copy-syntax-table))
+ (modify-syntax-entry 'ascii "<")
+ (Assert (null (re-search-forward "[[:alnum:]]" nil t))
+ "checking that a bug with dirty syntax table caches has been
fixed"))
+
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta