diff --git a/nodejs/build_support/x86_64_v2.rs b/nodejs/build_support/x86_64_v2.rs index a0ef3eb52..8161b5820 100644 --- a/nodejs/build_support/x86_64_v2.rs +++ b/nodejs/build_support/x86_64_v2.rs @@ -103,6 +103,10 @@ pub(crate) fn validate_encoded_rustflags(encoded: &str) -> Result<(), String> { fn codegen_options(encoded: &str) -> Result, String> { let arguments = encoded.split('\u{1f}').collect::>(); + if arguments.iter().any(|argument| argument.starts_with('@')) { + return Err("rustc response-file arguments cannot be validated".to_owned()); + } + let mut options = Vec::new(); let mut index = 0; @@ -262,4 +266,14 @@ mod tests { Err("LLVM arguments can override the CPU baseline".to_owned()) ); } + + #[test] + fn rejects_response_file_arguments() { + let flags = encoded(&["-Ctarget-cpu=x86-64-v2", "@flags.rsp"]); + + assert_eq!( + validate_encoded_rustflags(&flags), + Err("rustc response-file arguments cannot be validated".to_owned()) + ); + } }