aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-08-28 19:26:39 +0300
committerEli Zaretskii2014-08-28 19:26:39 +0300
commit74910c5d074b4173bd0469ca4e315e9deac78718 (patch)
tree7d507e092d78233423505ed3b1931a130583bbab /src/syntax.c
parentb62da77c1c94b393f8be7854ff1cb30b012aa238 (diff)
downloademacs-74910c5d074b4173bd0469ca4e315e9deac78718.tar.gz
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.c11
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)
2859 case Smath: 2859 case Smath:
2860 if (!sexpflag) 2860 if (!sexpflag)
2861 break; 2861 break;
2862 temp_pos = dec_bytepos (from_byte); 2862 if (from > BEGV)
2863 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); 2863 {
2864 if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) 2864 temp_pos = dec_bytepos (from_byte);
2865 DEC_BOTH (from, from_byte); 2865 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1);
2866 if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos))
2867 DEC_BOTH (from, from_byte);
2868 }
2866 if (mathexit) 2869 if (mathexit)
2867 { 2870 {
2868 mathexit = 0; 2871 mathexit = 0;