aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-08-27 22:40:54 +0300
committerEli Zaretskii2014-08-27 22:40:54 +0300
commit9bac5fd91f5012a682be13e16561671f0f01c941 (patch)
tree4a5508bd086ad5ee758b3d636348741d5ae154f3 /src/syntax.c
parent110d87a1cc6a47e31ad9d70cc6366dd81d213860 (diff)
downloademacs-9bac5fd91f5012a682be13e16561671f0f01c941.tar.gz
emacs-9bac5fd91f5012a682be13e16561671f0f01c941.zip
Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer.
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 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)
2857 case Smath: 2857 case Smath:
2858 if (!sexpflag) 2858 if (!sexpflag)
2859 break; 2859 break;
2860 temp_pos = dec_bytepos (from_byte); 2860 if (from > BEGV)
2861 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); 2861 {
2862 if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) 2862 temp_pos = dec_bytepos (from_byte);
2863 DEC_BOTH (from, from_byte); 2863 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1);
2864 if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos))
2865 DEC_BOTH (from, from_byte);
2866 }
2864 if (mathexit) 2867 if (mathexit)
2865 { 2868 {
2866 mathexit = 0; 2869 mathexit = 0;