diff options
author | Eli Zaretskii <eliz@gnu.org> | 2014-08-28 19:26:39 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2014-08-28 19:26:39 +0300 |
commit | 74910c5d074b4173bd0469ca4e315e9deac78718 (patch) | |
tree | 7d507e092d78233423505ed3b1931a130583bbab /src/syntax.c | |
parent | b62da77c1c94b393f8be7854ff1cb30b012aa238 (diff) | |
download | emacs-74910c5d074b4173bd0469ca4e315e9deac78718.tar.gz emacs-74910c5d074b4173bd0469ca4e315e9deac78718.tar.bz2 emacs-74910c5d074b4173bd0469ca4e315e9deac78718.zip |
Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer.
Back-ported from trunk revision-id: 2014-08-27T19:40:54Z!eliz@gnu.org
src/syntax.c (scan_lists): Don't examine positions before BEGV.
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c index 0ee48bb3725..5e697d350ff 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2859,10 +2859,13 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) case Smath: if (!sexpflag) break; - temp_pos = dec_bytepos (from_byte); - UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); - if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) - DEC_BOTH (from, from_byte); + if (from > BEGV) + { + temp_pos = dec_bytepos (from_byte); + UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); + if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) + DEC_BOTH (from, from_byte); + } if (mathexit) { mathexit = 0; |