Mercurial > hg > xemacs-beta
comparison src/regex.c @ 5680:8a2ac78cb97d
Pre-emptively update any dirty mirror syntax table before searching
src/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea@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@parhasard.net>
* automated/regexp-tests.el:
Make sure we can search for character ranges successfully when the
syntax table is dirty.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 02 Sep 2012 17:36:47 +0100 |
parents | 3df910176b6a |
children | e2fae7783046 |
comparison
equal
deleted
inserted
replaced
5679:a81a739181dc | 5680:8a2ac78cb97d |
---|---|
4661 } | 4661 } |
4662 #endif | 4662 #endif |
4663 | 4663 |
4664 #ifdef emacs | 4664 #ifdef emacs |
4665 BEGIN_REGEX_MALLOC_OK (); | 4665 BEGIN_REGEX_MALLOC_OK (); |
4666 update_mirror_syntax_if_dirty (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf)); | |
4666 scache = setup_syntax_cache (scache, lispobj, lispbuf, | 4667 scache = setup_syntax_cache (scache, lispobj, lispbuf, |
4667 offset_to_charxpos (lispobj, startpos), | 4668 offset_to_charxpos (lispobj, startpos), |
4668 1); | 4669 1); |
4669 END_REGEX_MALLOC_OK (); | 4670 END_REGEX_MALLOC_OK (); |
4670 RE_SEARCH_RELOCATE_MOVEABLE_DATA_POINTERS (); | 4671 RE_SEARCH_RELOCATE_MOVEABLE_DATA_POINTERS (); |
5050 RE_LISP_CONTEXT_ARGS_DECL) | 5051 RE_LISP_CONTEXT_ARGS_DECL) |
5051 { | 5052 { |
5052 int result; | 5053 int result; |
5053 | 5054 |
5054 #ifdef emacs | 5055 #ifdef emacs |
5056 /* Update the mirror syntax table if it's dirty now, this would otherwise | |
5057 cause a malloc() in charset_mule in re_match_2_internal() when checking | |
5058 characters' syntax. */ | |
5059 update_mirror_syntax_if_dirty (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf)); | |
5055 scache = setup_syntax_cache (scache, lispobj, lispbuf, | 5060 scache = setup_syntax_cache (scache, lispobj, lispbuf, |
5056 offset_to_charxpos (lispobj, pos), | 5061 offset_to_charxpos (lispobj, pos), |
5057 1); | 5062 1); |
5058 #endif | 5063 #endif |
5059 | 5064 |