summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-08-27 22:40:54 +0300
committerEli Zaretskii <eliz@gnu.org>2014-08-27 22:40:54 +0300
commit9bac5fd91f5012a682be13e16561671f0f01c941 (patch)
tree4a5508bd086ad5ee758b3d636348741d5ae154f3 /src/syntax.c
parent110d87a1cc6a47e31ad9d70cc6366dd81d213860 (diff)
downloademacs-9bac5fd91f5012a682be13e16561671f0f01c941.tar.gz
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)
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;