From: Eli Zaretskii Date: Wed, 27 Aug 2014 19:40:54 +0000 (+0300) Subject: Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer. X-Git-Tag: emacs-25.0.90~2635^2~679^2~419 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9bac5fd91f5012a682be13e16561671f0f01c941;p=emacs.git Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer. src/syntax.c (scan_lists): Don't examine positions before BEGV. --- diff --git a/src/ChangeLog b/src/ChangeLog index 8a32bc27b0b..a7c8cb59a0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-08-27 Eli Zaretskii + + * syntax.c (scan_lists): Don't examine positions before BEGV. + (Bug#18339) + 2014-08-27 Paul Eggert Improve robustness of new string-collation code (Bug#18051). diff --git a/src/syntax.c b/src/syntax.c index 4166ee211c7..df8800e90be 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2857,10 +2857,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;