]> code.delx.au - gnu-emacs/commitdiff
Fix crashes when restoring sub-char-tables from desktop file
authorEli Zaretskii <eliz@gnu.org>
Fri, 27 Mar 2015 13:16:36 +0000 (16:16 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 27 Mar 2015 13:16:36 +0000 (16:16 +0300)
 src/lread.c (substitute_object_recurse): For sub-char-tables, start
 the recursive SUBSTITUTE loop from index of 2, to skip the
 non-Lisp members of the sub-char-table.  See the discussion at
 http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00520.html
 for the details.

src/ChangeLog
src/lread.c

index c003e4454db05af168b5729613cad7536012435d..98037e851a4088b332df71daa6d210b15c3ae87e 100644 (file)
@@ -1,5 +1,11 @@
 2015-03-27  Eli Zaretskii  <eliz@gnu.org>
 
+       * lread.c (substitute_object_recurse): For sub-char-tables, start
+       the recursive SUBSTITUTE loop from index of 2, to skip the
+       non-Lisp members of the sub-char-table.  See the discussion at
+       http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00520.html
+       for the details.
+
        Support non-blocking connect on MS-Windows.
        Based on ideas from Kim F. Storm <storm@cua.dk>, see
        http://lists.gnu.org/archive/html/emacs-devel/2006-12/msg00873.html.
index ae175296ddbdbd61018428c0b4e81901c8556c3f..050e43e2d08ab61cdbb2647679edc3e818a161d4 100644 (file)
@@ -3280,7 +3280,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
     {
     case Lisp_Vectorlike:
       {
-       ptrdiff_t i, length = 0;
+       ptrdiff_t i = 0, length = 0;
        if (BOOL_VECTOR_P (subtree))
          return subtree;               /* No sub-objects anyway.  */
        else if (CHAR_TABLE_P (subtree) || SUB_CHAR_TABLE_P (subtree)
@@ -3295,7 +3295,9 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
             behavior.  */
          wrong_type_argument (Qsequencep, subtree);
 
-       for (i = 0; i < length; i++)
+       if (SUB_CHAR_TABLE_P (subtree))
+         i = 2;
+       for ( ; i < length; i++)
          SUBSTITUTE (AREF (subtree, i),
                      ASET (subtree, i, true_value));
        return subtree;