]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer.
authorEli Zaretskii <eliz@gnu.org>
Thu, 28 Aug 2014 16:26:39 +0000 (19:26 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 28 Aug 2014 16:26:39 +0000 (19:26 +0300)
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.

src/ChangeLog
src/syntax.c

index 8ca95025019ccfff54d60a76c5325845ab3c128a..b3744eb8b6eb5cac5beb48159f8c10beb843ca4d 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * syntax.c (scan_lists): Don't examine positions before BEGV.
+       (Bug#18339)
+
 2014-08-25  Eli Zaretskii  <eliz@gnu.org>
 
        * conf_post.h (_GL_EXECINFO_INLINE) [MSDOS]: Don't define.
index 0ee48bb3725f90bbb206f2ffbf37a9dd88f8bfc6..5e697d350ff0e2f87db1cf20d429b574cb086d2c 100644 (file)
@@ -2859,10 +2859,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;