summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-03-20 06:30:40 +0100
committerStefan Kangas <stefankangas@gmail.com>2023-03-20 06:30:40 +0100
commit42fba8f36b19536964d6deb6a34f3fd1c02b43dd (patch)
tree18d6ddfda8b2560d0ed6cddd221b65418007190d /src
parent3a11371d54483e17d802d41158f862870720c166 (diff)
parentb7f03333551b2214f4d151d25d319e62402167c1 (diff)
downloademacs-42fba8f36b19536964d6deb6a34f3fd1c02b43dd.tar.gz
Merge from origin/emacs-29
b7f03333551 Improve warning about changing the string returned by sym... e62f8b0239d Fix visiting XBM/XPM files when 'c-ts-mode' is active 94d1c81cf07 * lisp/mpc.el (mpc-format): Fix oversight in commit 48b6c... a4d97811ed4 Bail early from eglot--apply-text-edits if nothing to do 61d571760b3 ; Clarify in-code commentary of eglot--after-change 5bbbd70f56e Improve ergonomics of Eglot's inlay hints c3a543123ab Protect against too large size of 'recent-keys' vector 231190b37f8 * lisp/net/tramp.el (tramp-yn-prompt-regexp): Fix regexp. 0bebd0e5f09 ; Remove 'build-module' and 'html-manual' directories fro... 6674c362ad9 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 829e5dfabea Update to Org 9.6.1-48-g92471e e84f878e19a ; * admin/notes/tree-sitter/starter-guide: Update starter... ea0949853f8 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 11592bcfda6 ; * lisp/nxml/xmltok.el (xmltok-scan-attributes): Fix las... e388a77cf0b ; Minor copyedits of recent changes in ELisp reference ma... 33a26703689 ; Minor fixes in recent Eglot changes d2cf1386fa4 ; * doc/misc/eglot.texi (Eglot Commands): Improve indexing. b75e489362b ; Again correct node reference casing in doc/misc/eglot.texi a55d2edc5a9 ; Remove overly verbose commentary 22a70451f34 Merge confusing duplicate sections on commands in Eglot m... 3293f939882 Don't take over mouse-1 binding on Eglot diagnostics (bug... 013057e3512 ; Prefer "language server" to "LSP server" in Eglot manual 94a21c88647 * lisp/progmodes/eglot.el (eglot--connect): Improve Tramp... 0eddfa28ebd Avoid slowdowns in xmltok-scan-attributes 647c6bf2a6c ; * test/lisp/abbrev-tests.el (abbrev--possibly-save-test... 531f8f7103a ; * admin/git-bisect-start: Update failing commits # Conflicts: # admin/notes/tree-sitter/build-module/batch.sh # admin/notes/tree-sitter/build-module/build.sh
Diffstat (limited to 'src')
-rw-r--r--src/data.c5
-rw-r--r--src/keyboard.c17
2 files changed, 19 insertions, 3 deletions
diff --git a/src/data.c b/src/data.c
index d2f4d40d7bc..8dc5000424e 100644
--- a/src/data.c
+++ b/src/data.c
@@ -773,7 +773,10 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
}
DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
- doc: /* Return SYMBOL's name, a string. */)
+ doc: /* Return SYMBOL's name, a string.
+
+Warning: never alter the string returned by `symbol-name'.
+Doing that might make Emacs dysfunctional, and might even crash Emacs. */)
(register Lisp_Object symbol)
{
register Lisp_Object name;
diff --git a/src/keyboard.c b/src/keyboard.c
index b2816f8270b..f7aa496bb81 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -105,6 +105,13 @@ static bool single_kboard;
/* Minimum allowed size of the recent_keys vector. */
#define MIN_NUM_RECENT_KEYS (100)
+/* Maximum allowed size of the recent_keys vector. */
+#if INTPTR_MAX <= INT_MAX
+# define MAX_NUM_RECENT_KEYS (INT_MAX / EMACS_INT_WIDTH / 10)
+#else
+# define MAX_NUM_RECENT_KEYS (INT_MAX / EMACS_INT_WIDTH)
+#endif
+
/* Index for storing next element into recent_keys. */
static int recent_keys_index;
@@ -10984,10 +10991,10 @@ The saved keystrokes are shown by `view-lossage'. */)
if (!FIXNATP (arg))
user_error ("Value must be a positive integer");
- int osize = ASIZE (recent_keys);
+ ptrdiff_t osize = ASIZE (recent_keys);
eassert (lossage_limit == osize);
int min_size = MIN_NUM_RECENT_KEYS;
- int new_size = XFIXNAT (arg);
+ EMACS_INT new_size = XFIXNAT (arg);
if (new_size == osize)
return make_fixnum (lossage_limit);
@@ -10997,6 +11004,12 @@ The saved keystrokes are shown by `view-lossage'. */)
AUTO_STRING (fmt, "Value must be >= %d");
Fsignal (Quser_error, list1 (CALLN (Fformat, fmt, make_fixnum (min_size))));
}
+ if (new_size > MAX_NUM_RECENT_KEYS)
+ {
+ AUTO_STRING (fmt, "Value must be <= %d");
+ Fsignal (Quser_error, list1 (CALLN (Fformat, fmt,
+ make_fixnum (MAX_NUM_RECENT_KEYS))));
+ }
int kept_keys = new_size > osize ? total_keys : min (new_size, total_keys);
update_recent_keys (new_size, kept_keys);