diff options
| author | Robert Pluim | 2025-01-20 18:43:00 +0100 |
|---|---|---|
| committer | Robert Pluim | 2025-01-21 17:41:35 +0100 |
| commit | 14e686e6cca83054afceb353ad7a1e24ebdb0133 (patch) | |
| tree | e99e109e2825c9d33009238b42b89cfef415deea /src | |
| parent | 64d314e0f6495de6fcf4f4c51e710b597a237e4f (diff) | |
| download | emacs-14e686e6cca83054afceb353ad7a1e24ebdb0133.tar.gz emacs-14e686e6cca83054afceb353ad7a1e24ebdb0133.zip | |
Signal error when keyword/arg list is malformed
* src/data.c (syms_of_data): Add Qmalformed_keyword_arg_list
error symbol.
* src/process.c (Fmake_process, Fmake_pipe_process)
(Fserial_process_configure, Fmake_serial_process)
(Fmake_network_process): Signal Qmalformed_keyword_arg_list when
the argument list length is odd.
* src/sound.c (parse_sound): Also here..
* src/w32fns.c (Fw32_notification_notify): ..and here.
(Bug#75584)
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 3 | ||||
| -rw-r--r-- | src/lisp.h | 9 | ||||
| -rw-r--r-- | src/process.c | 6 | ||||
| -rw-r--r-- | src/sound.c | 4 | ||||
| -rw-r--r-- | src/w32fns.c | 1 |
5 files changed, 22 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c index 077719c4062..dcaa5756ebe 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -4020,6 +4020,7 @@ syms_of_data (void) | |||
| 4020 | 4020 | ||
| 4021 | DEFSYM (Qinvalid_function, "invalid-function"); | 4021 | DEFSYM (Qinvalid_function, "invalid-function"); |
| 4022 | DEFSYM (Qwrong_number_of_arguments, "wrong-number-of-arguments"); | 4022 | DEFSYM (Qwrong_number_of_arguments, "wrong-number-of-arguments"); |
| 4023 | DEFSYM (Qmalformed_keyword_arg_list, "malformed-keyword-arg-list"); | ||
| 4023 | DEFSYM (Qno_catch, "no-catch"); | 4024 | DEFSYM (Qno_catch, "no-catch"); |
| 4024 | DEFSYM (Qend_of_file, "end-of-file"); | 4025 | DEFSYM (Qend_of_file, "end-of-file"); |
| 4025 | DEFSYM (Qarith_error, "arith-error"); | 4026 | DEFSYM (Qarith_error, "arith-error"); |
| @@ -4119,6 +4120,8 @@ syms_of_data (void) | |||
| 4119 | PUT_ERROR (Qinvalid_function, error_tail, "Invalid function"); | 4120 | PUT_ERROR (Qinvalid_function, error_tail, "Invalid function"); |
| 4120 | PUT_ERROR (Qwrong_number_of_arguments, error_tail, | 4121 | PUT_ERROR (Qwrong_number_of_arguments, error_tail, |
| 4121 | "Wrong number of arguments"); | 4122 | "Wrong number of arguments"); |
| 4123 | PUT_ERROR (Qmalformed_keyword_arg_list, error_tail, | ||
| 4124 | "Keyword lacks a corresponding value"); | ||
| 4122 | PUT_ERROR (Qno_catch, error_tail, "No catch for tag"); | 4125 | PUT_ERROR (Qno_catch, error_tail, "No catch for tag"); |
| 4123 | PUT_ERROR (Qend_of_file, error_tail, "End of file during parsing"); | 4126 | PUT_ERROR (Qend_of_file, error_tail, "End of file during parsing"); |
| 4124 | 4127 | ||
diff --git a/src/lisp.h b/src/lisp.h index 8b870119315..28fa4c8037e 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4911,6 +4911,15 @@ extern Lisp_Object safe_funcall (ptrdiff_t, Lisp_Object*); | |||
| 4911 | #define safe_calln(...) \ | 4911 | #define safe_calln(...) \ |
| 4912 | CALLMANY (safe_funcall, ((Lisp_Object []) {__VA_ARGS__})) | 4912 | CALLMANY (safe_funcall, ((Lisp_Object []) {__VA_ARGS__})) |
| 4913 | 4913 | ||
| 4914 | INLINE void | ||
| 4915 | CHECK_KEYWORD_ARGS (ptrdiff_t nargs) | ||
| 4916 | { | ||
| 4917 | /* Used to check if a list of keyword/value pairs is missing a | ||
| 4918 | value. */ | ||
| 4919 | if (nargs & 1) | ||
| 4920 | xsignal0 (Qmalformed_keyword_arg_list); | ||
| 4921 | } | ||
| 4922 | |||
| 4914 | extern void init_eval (void); | 4923 | extern void init_eval (void); |
| 4915 | extern void syms_of_eval (void); | 4924 | extern void syms_of_eval (void); |
| 4916 | extern void prog_ignore (Lisp_Object); | 4925 | extern void prog_ignore (Lisp_Object); |
diff --git a/src/process.c b/src/process.c index cd1149ae8b0..275e86f31d0 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1822,6 +1822,7 @@ usage: (make-process &rest ARGS) */) | |||
| 1822 | 1822 | ||
| 1823 | if (nargs == 0) | 1823 | if (nargs == 0) |
| 1824 | return Qnil; | 1824 | return Qnil; |
| 1825 | CHECK_KEYWORD_ARGS (nargs); | ||
| 1825 | 1826 | ||
| 1826 | /* Save arguments for process-contact and clone-process. */ | 1827 | /* Save arguments for process-contact and clone-process. */ |
| 1827 | contact = Flist (nargs, args); | 1828 | contact = Flist (nargs, args); |
| @@ -2431,6 +2432,7 @@ usage: (make-pipe-process &rest ARGS) */) | |||
| 2431 | 2432 | ||
| 2432 | if (nargs == 0) | 2433 | if (nargs == 0) |
| 2433 | return Qnil; | 2434 | return Qnil; |
| 2435 | CHECK_KEYWORD_ARGS (nargs); | ||
| 2434 | 2436 | ||
| 2435 | contact = Flist (nargs, args); | 2437 | contact = Flist (nargs, args); |
| 2436 | 2438 | ||
| @@ -3066,6 +3068,8 @@ usage: (serial-process-configure &rest ARGS) */) | |||
| 3066 | Lisp_Object contact = Qnil; | 3068 | Lisp_Object contact = Qnil; |
| 3067 | Lisp_Object proc = Qnil; | 3069 | Lisp_Object proc = Qnil; |
| 3068 | 3070 | ||
| 3071 | CHECK_KEYWORD_ARGS (nargs); | ||
| 3072 | |||
| 3069 | contact = Flist (nargs, args); | 3073 | contact = Flist (nargs, args); |
| 3070 | 3074 | ||
| 3071 | proc = plist_get (contact, QCprocess); | 3075 | proc = plist_get (contact, QCprocess); |
| @@ -3170,6 +3174,7 @@ usage: (make-serial-process &rest ARGS) */) | |||
| 3170 | 3174 | ||
| 3171 | if (nargs == 0) | 3175 | if (nargs == 0) |
| 3172 | return Qnil; | 3176 | return Qnil; |
| 3177 | CHECK_KEYWORD_ARGS (nargs); | ||
| 3173 | 3178 | ||
| 3174 | contact = Flist (nargs, args); | 3179 | contact = Flist (nargs, args); |
| 3175 | 3180 | ||
| @@ -3971,6 +3976,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3971 | 3976 | ||
| 3972 | if (nargs == 0) | 3977 | if (nargs == 0) |
| 3973 | return Qnil; | 3978 | return Qnil; |
| 3979 | CHECK_KEYWORD_ARGS (nargs); | ||
| 3974 | 3980 | ||
| 3975 | /* Save arguments for process-contact and clone-process. */ | 3981 | /* Save arguments for process-contact and clone-process. */ |
| 3976 | contact = Flist (nargs, args); | 3982 | contact = Flist (nargs, args); |
diff --git a/src/sound.c b/src/sound.c index 67a1e99e31c..5e6acdb4743 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -359,9 +359,11 @@ sound_warning (const char *msg) | |||
| 359 | static bool | 359 | static bool |
| 360 | parse_sound (Lisp_Object sound, Lisp_Object *attrs) | 360 | parse_sound (Lisp_Object sound, Lisp_Object *attrs) |
| 361 | { | 361 | { |
| 362 | /* SOUND must be a list starting with the symbol `sound'. */ | 362 | /* SOUND must be a list starting with the symbol `sound' followed by a |
| 363 | number of keyword/value argument pairs. */ | ||
| 363 | if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) | 364 | if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) |
| 364 | return 0; | 365 | return 0; |
| 366 | CHECK_KEYWORD_ARGS (list_length (sound) - 1); | ||
| 365 | 367 | ||
| 366 | sound = XCDR (sound); | 368 | sound = XCDR (sound); |
| 367 | attrs[SOUND_FILE] = plist_get (sound, QCfile); | 369 | attrs[SOUND_FILE] = plist_get (sound, QCfile); |
diff --git a/src/w32fns.c b/src/w32fns.c index c2551ea2378..225a3a0999e 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -10655,6 +10655,7 @@ usage: (w32-notification-notify &rest PARAMS) */) | |||
| 10655 | 10655 | ||
| 10656 | if (nargs == 0 || !pfnShell_NotifyIconW) | 10656 | if (nargs == 0 || !pfnShell_NotifyIconW) |
| 10657 | return Qnil; | 10657 | return Qnil; |
| 10658 | CHECK_KEYWORD_ARGS (nargs); | ||
| 10658 | 10659 | ||
| 10659 | arg_plist = Flist (nargs, args); | 10660 | arg_plist = Flist (nargs, args); |
| 10660 | 10661 | ||