]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer.
authorEli Zaretskii <eliz@gnu.org>
Wed, 27 Aug 2014 19:40:54 +0000 (22:40 +0300)
committerEli Zaretskii <eliz@gnu.org>
Wed, 27 Aug 2014 19:40:54 +0000 (22:40 +0300)
 src/syntax.c (scan_lists): Don't examine positions before BEGV.

src/ChangeLog
src/syntax.c

index 8a32bc27b0bed9676831eeac5cef22fa90573685..a7c8cb59a0ff4cb350d0c8be3b359853b9fcb4e0 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * syntax.c (scan_lists): Don't examine positions before BEGV.
+       (Bug#18339)
+
 2014-08-27  Paul Eggert  <eggert@cs.ucla.edu>
 
        Improve robustness of new string-collation code (Bug#18051).
index 4166ee211c76eadad95dc1b15ce70c53a6278131..df8800e90befc94d443fd4dc0319040329dfb759 100644 (file)
@@ -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;