diff options
| author | Eli Zaretskii | 2015-10-03 13:44:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-10-03 13:44:44 +0300 |
| commit | 658f2c450d17357d8c09a07ca92c2ca980c3c797 (patch) | |
| tree | 398db0e54815fa452a3605d0c30bd7778235359b /src | |
| parent | 40892b46f8219e4c7795038f91878f85eaeb7bc5 (diff) | |
| download | emacs-658f2c450d17357d8c09a07ca92c2ca980c3c797.tar.gz emacs-658f2c450d17357d8c09a07ca92c2ca980c3c797.zip | |
Avoid crashes due to invalid coding-system
* src/fileio.c (choose_write_coding_system)
(Finsert_file_contents): Check validity of coding-system-for-write
and coding-system-for-read bound by the caller. (Bug#21602)
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index e4b255a53ac..65aaf572fd7 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3470,7 +3470,10 @@ by calling `format-decode', which see. */) | |||
| 3470 | mtime = time_error_value (save_errno); | 3470 | mtime = time_error_value (save_errno); |
| 3471 | st.st_size = -1; | 3471 | st.st_size = -1; |
| 3472 | if (!NILP (Vcoding_system_for_read)) | 3472 | if (!NILP (Vcoding_system_for_read)) |
| 3473 | Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); | 3473 | { |
| 3474 | CHECK_CODING_SYSTEM (Vcoding_system_for_read); | ||
| 3475 | Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); | ||
| 3476 | } | ||
| 3474 | goto notfound; | 3477 | goto notfound; |
| 3475 | } | 3478 | } |
| 3476 | 3479 | ||
| @@ -4526,6 +4529,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file | |||
| 4526 | else if (!NILP (Vcoding_system_for_write)) | 4529 | else if (!NILP (Vcoding_system_for_write)) |
| 4527 | { | 4530 | { |
| 4528 | val = Vcoding_system_for_write; | 4531 | val = Vcoding_system_for_write; |
| 4532 | CHECK_CODING_SYSTEM (val); | ||
| 4529 | if (coding_system_require_warning | 4533 | if (coding_system_require_warning |
| 4530 | && !NILP (Ffboundp (Vselect_safe_coding_system_function))) | 4534 | && !NILP (Ffboundp (Vselect_safe_coding_system_function))) |
| 4531 | /* Confirm that VAL can surely encode the current region. */ | 4535 | /* Confirm that VAL can surely encode the current region. */ |
| @@ -4574,6 +4578,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file | |||
| 4574 | using_default_coding = 1; | 4578 | using_default_coding = 1; |
| 4575 | } | 4579 | } |
| 4576 | 4580 | ||
| 4581 | if (!NILP (val)) | ||
| 4582 | CHECK_CODING_SYSTEM (val); | ||
| 4583 | |||
| 4577 | if (! NILP (val) && ! force_raw_text) | 4584 | if (! NILP (val) && ! force_raw_text) |
| 4578 | { | 4585 | { |
| 4579 | Lisp_Object spec, attrs; | 4586 | Lisp_Object spec, attrs; |