diff options
| author | Paul Eggert | 2014-07-14 12:07:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-07-14 12:07:54 -0700 |
| commit | 091adafaac52ff409790728af63cab19bd52fc8f (patch) | |
| tree | 222df9c21e51b556791a0e15373e34cdf08d74c1 /src/macros.c | |
| parent | 918be62752b7b3cd6e4a48e656dcbb52c3fc8073 (diff) | |
| download | emacs-091adafaac52ff409790728af63cab19bd52fc8f.tar.gz emacs-091adafaac52ff409790728af63cab19bd52fc8f.zip | |
* macros.c (Fstart_kbd_macro): Avoid need for overflow check.
Diffstat (limited to 'src/macros.c')
| -rw-r--r-- | src/macros.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/macros.c b/src/macros.c index 07667f09431..4730a8becc9 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -87,16 +87,13 @@ macro before appending to it. */) | |||
| 87 | /* Check the type of last-kbd-macro in case Lisp code changed it. */ | 87 | /* Check the type of last-kbd-macro in case Lisp code changed it. */ |
| 88 | len = CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); | 88 | len = CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); |
| 89 | 89 | ||
| 90 | if (INT_ADD_OVERFLOW (len, incr)) | ||
| 91 | memory_full (SIZE_MAX); | ||
| 92 | |||
| 93 | /* Copy last-kbd-macro into the buffer, in case the Lisp code | 90 | /* Copy last-kbd-macro into the buffer, in case the Lisp code |
| 94 | has put another macro there. */ | 91 | has put another macro there. */ |
| 95 | if (current_kboard->kbd_macro_bufsize < len + incr) | 92 | if (current_kboard->kbd_macro_bufsize - incr < len) |
| 96 | current_kboard->kbd_macro_buffer = | 93 | current_kboard->kbd_macro_buffer = |
| 97 | xpalloc (current_kboard->kbd_macro_buffer, | 94 | xpalloc (current_kboard->kbd_macro_buffer, |
| 98 | ¤t_kboard->kbd_macro_bufsize, | 95 | ¤t_kboard->kbd_macro_bufsize, |
| 99 | len + incr - current_kboard->kbd_macro_bufsize, -1, | 96 | len - current_kboard->kbd_macro_bufsize + incr, -1, |
| 100 | sizeof *current_kboard->kbd_macro_buffer); | 97 | sizeof *current_kboard->kbd_macro_buffer); |
| 101 | 98 | ||
| 102 | /* Must convert meta modifier when copying string to vector. */ | 99 | /* Must convert meta modifier when copying string to vector. */ |