aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias EngdegÄrd2020-04-06 15:20:08 +0200
committerMattias EngdegÄrd2020-04-09 11:34:48 +0200
commit402cbc5be26827244075dbe14288e7722290f83a (patch)
tree6238d25cbd648e14cb1dcc309a8542fc312e40bf /src
parent20eb4247cdc2eeada43c3de8abf9c577be38c98f (diff)
downloademacs-402cbc5be26827244075dbe14288e7722290f83a.tar.gz
emacs-402cbc5be26827244075dbe14288e7722290f83a.zip
Don't rely on copying in {EN,DE}CODE_FILE
Callers of ENCODE_FILE and DECODE_FILE should not assume that these functions always return a new string (bug#40407). * src/w32fns.c (Fw32_shell_execute): * src/w32proc.c (Fw32_application_type): Sink taking the address of a Lisp string past GC points. Copy values returned from ENCODE_FILE before mutating them.
Diffstat (limited to 'src')
-rw-r--r--src/w32fns.c4
-rw-r--r--src/w32proc.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 9bb4e27b018..8d714f0b8d0 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -8258,7 +8258,6 @@ a ShowWindow flag:
8258 /* Encode filename, current directory and parameters. */ 8258 /* Encode filename, current directory and parameters. */
8259 current_dir = GUI_ENCODE_FILE (current_dir); 8259 current_dir = GUI_ENCODE_FILE (current_dir);
8260 document = GUI_ENCODE_FILE (document); 8260 document = GUI_ENCODE_FILE (document);
8261 doc_w = GUI_SDATA (document);
8262 if (STRINGP (parameters)) 8261 if (STRINGP (parameters))
8263 { 8262 {
8264 parameters = GUI_ENCODE_SYSTEM (parameters); 8263 parameters = GUI_ENCODE_SYSTEM (parameters);
@@ -8269,6 +8268,7 @@ a ShowWindow flag:
8269 operation = GUI_ENCODE_SYSTEM (operation); 8268 operation = GUI_ENCODE_SYSTEM (operation);
8270 ops_w = GUI_SDATA (operation); 8269 ops_w = GUI_SDATA (operation);
8271 } 8270 }
8271 doc_w = GUI_SDATA (document);
8272 result = (intptr_t) ShellExecuteW (NULL, ops_w, doc_w, params_w, 8272 result = (intptr_t) ShellExecuteW (NULL, ops_w, doc_w, params_w,
8273 GUI_SDATA (current_dir), 8273 GUI_SDATA (current_dir),
8274 (FIXNUMP (show_flag) 8274 (FIXNUMP (show_flag)
@@ -8353,7 +8353,7 @@ a ShowWindow flag:
8353 handler = Ffind_file_name_handler (absdoc, Qfile_exists_p); 8353 handler = Ffind_file_name_handler (absdoc, Qfile_exists_p);
8354 if (NILP (handler)) 8354 if (NILP (handler))
8355 { 8355 {
8356 Lisp_Object absdoc_encoded = ENCODE_FILE (absdoc); 8356 Lisp_Object absdoc_encoded = Fcopy_sequence (ENCODE_FILE (absdoc));
8357 8357
8358 if (faccessat (AT_FDCWD, SSDATA (absdoc_encoded), F_OK, AT_EACCESS) == 0) 8358 if (faccessat (AT_FDCWD, SSDATA (absdoc_encoded), F_OK, AT_EACCESS) == 0)
8359 { 8359 {
diff --git a/src/w32proc.c b/src/w32proc.c
index de337269050..16e32e4c58d 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3231,7 +3231,7 @@ such programs cannot be invoked by Emacs anyway. */)
3231 char *progname, progname_a[MAX_PATH]; 3231 char *progname, progname_a[MAX_PATH];
3232 3232
3233 program = Fexpand_file_name (program, Qnil); 3233 program = Fexpand_file_name (program, Qnil);
3234 encoded_progname = ENCODE_FILE (program); 3234 encoded_progname = Fcopy_sequence (ENCODE_FILE (program));
3235 progname = SSDATA (encoded_progname); 3235 progname = SSDATA (encoded_progname);
3236 unixtodos_filename (progname); 3236 unixtodos_filename (progname);
3237 filename_to_ansi (progname, progname_a); 3237 filename_to_ansi (progname, progname_a);