Fix test_subprocess

This commit is contained in:
Jeong, YunWon committed 2025-12-12 20:26:47 +09:00
1 parent 5a5b721576
commit b9fa405fd4
2 files changed
+12 -1

No files matched your search

-1
View File
@@ -857,7 +857,6 @@ class ProcessTestCase(BaseTestCase):
self.assertEqual(p.returncode, 0)
self.assertEqual(stdout.strip(), b"fruit=orange")
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON, null byte is not checked")
def test_invalid_cmd(self):
# null character in the command name
cmd = sys.executable + '\0'
+12
View File
@@ -248,6 +248,18 @@ mod _winapi {
Ok(ws.into_vec_with_nul())
};
// Validate no embedded null bytes in command name and command line
if let Some(ref name) = args.name
&& name.as_str().contains('\0')
{
return Err(crate::exceptions::cstring_error(vm));
}
if let Some(ref cmd) = args.command_line
&& cmd.as_str().contains('\0')
{
return Err(crate::exceptions::cstring_error(vm));
}
let app_name = args.name.map(wstr).transpose()?;
let app_name = app_name.as_ref().map_or_else(null, |w| w.as_ptr());