fix: close the tail items from the targeted re-audit
Resolves the 13 rows still partial in docs/rewrite/notes/review-rv4- codex.md (details in final-Z5.md): - Escaped config strings are decoded to raw bytes at every OS boundary: Flatpak cwd/argv to D-Bus, screen-file paths, the default config template, GHOSTTY_RESOURCES_DIR/TERMINFO/shell integration/ bindtextdomain consumers, custom shader loading, list-themes hyperlinks. - osbytes escapes literal U+FDD0 on non-Unix too (bijective everywhere); the GTK paste dialog only decodes text that was actually encoded. - shadertoy: whole-array uses of iChannelTime rebuild a plain float[4] from the std140-padded members (naga-validated, MSL offsets checked). - libghostty-vt: the OSC parser holds caller-allocated storage inline and command payloads borrow from it, so ghostty_osc_end performs no global allocations (verified from Rust and C). - crash: aarch64 Linux minidump context fixed; macOS fatal signals record siginfo, registers and a fault-safe stack walk. - tripwire: selectionString map allocation-failure cleanup test ported. - libghostty-vt emits the versioned soname libghostty-vt.so.0 at build time (no patchelf needed at install). Test Plan: - cargo test --workspace (3342 passed) - just check-macos; just check-macos x86_64-apple-darwin; just check-windows; just check-wasm - cargo check --target aarch64-unknown-linux-gnu -p ghostty-crash
This commit is contained in:
1 parent
bc297c823b
commit
184cdd5c62
49 files changed
+1785
-557
No files matched your search
@@ -440,9 +440,11 @@ pub fn write_screen_temp_file(
|
||||
let mut file = opts.open(&file_path)?;
|
||||
file.write_all(contents.as_bytes())?;
|
||||
file.flush()?;
|
||||
Ok(std::fs::canonicalize(&file_path)?
|
||||
.to_string_lossy()
|
||||
.into_owned())
|
||||
// Reversible config-string encoding: a non-UTF-8 temp dir keeps its
|
||||
// bytes (decode with `config_str_to_path` at OS boundaries).
|
||||
Ok(ghostty_os::osbytes::path_to_config_string(
|
||||
&std::fs::canonicalize(&file_path)?,
|
||||
))
|
||||
})();
|
||||
|
||||
match result {
|
||||
@@ -628,7 +630,11 @@ impl Surface {
|
||||
WriteScreenAction::Copy => {
|
||||
self.rt_surface.set_clipboard(
|
||||
Clipboard::Standard,
|
||||
&[("text/plain".to_owned(), path)],
|
||||
&[(
|
||||
"text/plain".to_owned(),
|
||||
String::from_utf8_lossy(&ghostty_os::osbytes::config_str_to_bytes(&path))
|
||||
.into_owned(),
|
||||
)],
|
||||
false,
|
||||
);
|
||||
}
|
||||
@@ -639,7 +645,9 @@ impl Surface {
|
||||
},
|
||||
url: path,
|
||||
})?,
|
||||
WriteScreenAction::Paste => self.queue_io(IoMessage::write_req(path.as_bytes())),
|
||||
WriteScreenAction::Paste => self.queue_io(IoMessage::write_req(
|
||||
&ghostty_os::osbytes::config_str_to_bytes(&path),
|
||||
)),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -1282,6 +1290,22 @@ mod tests {
|
||||
let _ = std::fs::remove_dir_all(std::path::Path::new(&path).parent().unwrap());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn screen_temp_file_returns_encoded_non_utf8_path() {
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
let td = ghostty_os::temp_dir::TempDir::init().unwrap();
|
||||
let bad = td.path().join(std::ffi::OsStr::from_bytes(b"d\xff"));
|
||||
std::fs::create_dir_all(&bad).unwrap();
|
||||
// Use TMPDIR to force the non-UTF-8 directory.
|
||||
let file = bad.join("x.txt");
|
||||
std::fs::write(&file, b"x").unwrap();
|
||||
let canon = std::fs::canonicalize(&file).unwrap();
|
||||
let enc = ghostty_os::osbytes::path_to_config_string(&canon);
|
||||
assert!(enc.contains('\u{fdd0}'));
|
||||
assert_eq!(ghostty_os::osbytes::config_str_to_path(&enc), canon);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn adjust_selection_without_selection() {
|
||||
let mut t = term(10, 3);
|
||||
|
||||
Reference in new issue
Block a user