fix(formats,core): Layout::copy_table panics on render_xor & misses 3D depth_pitch overlap check; empty env vars in default_dir #320
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI#320
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@RUIZ-Enrique-25002136 on GitHub · 2026-12-02 09:14 UTC · original
Summary
Three platform-independent bugs exist in
crates/victory-formats/src/texture.rsandcrates/victory-core/src/config.rs:Layout::copy_tablepanics with an out-of-bounds index when given aconfigure_render_xorlayout (SW_64KB_R_X) instead of returningErr(Error::Unsupported).Layout::copy_tableomits thedepth > 1 && depth_pitch < slice_bytesoverlap validation enforced byLayout::detile/Layout::tile.config::default_dirdoes not filter emptyLOCALAPPDATA,XDG_CACHE_HOME, orHOMEvalues, producing relative paths in the current working directory.Evidence (
file:line& Code Proof)1. Out-of-Bounds Panic in
Layout::copy_tableonrender_xorLayoutscrates/victory-formats/src/texture.rs:548-558, 576-599, 653-658, 958-996:For
SW_64KB_R_X(d.swizzle.xor() == true),Layout::tiledleavesself.pattern = &EMPTY_PATTERN([Vec::new(); 3]).Layout::configure_render_xorsetsself.render_xor = Some(config), causingLayout::addressable()(texture.rs:597-599) to returntrue.Layout::offset(628) andLayout::walk(774) handleself.render_xor, whereasLayout::copy_table(958-996) skips checkingself.render_xorand callsself.column(m, 0)(657), which indexesself.pattern[0][(x % bw) as usize]on an emptyVecand panics.crates/victory-gpu/src/detile.rs:758callslayout.copy_table(...)expectingErr(_)to map toWhy::NoTableand fall back to CPU detiling.2. Missing 3D Depth-Slice Overlap Check in
Layout::copy_tablecrates/victory-formats/src/texture.rs:963-971vs751-764(Layout::walk):Layout::walkrejects overlapping depth slices withif depth > 1 && depth_pitch < slice_bytes { return Err(Error::TooSmall); }.Layout::copy_table(whose doc promises "The same checks as the detile") omits this check, allowingdepth > 1withdepth_pitch < slice_bytes(includingdepth_pitch == 0) to return overlappingCopyRow::linearoffsets.3. Empty Env Vars Produce Relative Paths in
config::default_dircrates/victory-core/src/config.rs:146-156(default_dir):Every other env helper in
config.rs(env_path:81,explicit_config_path:125,home_override:141) filters empty strings via.filter(|v| !v.is_empty()), whereasdefault_dircallsstd::env::var_os("LOCALAPPDATA"),std::env::var_os("XDG_CACHE_HOME"), andstd::env::var_os("HOME")without filtering empty values (violating the XDG Base Directory spec and creating relativevictory/cache/.cache/victory/cachepaths in CWD).Impact
copy_tablepanics instead of falling back to CPU detiling when given arender_xorlayout, and silently produces corrupt overlapping 3DCopyTables whendepth_pitch < slice_bytes.LOCALAPPDATA/XDG_CACHE_HOME/HOMEcausesdefault_dirto resolve inside CWD (failingensure_outside_repowhen run from the repo or polluting CWD).AI-Ready Fix Specification
crates/victory-formats/src/texture.rs(Layout::copy_table):Err(Error::Unsupported)if!self.addressable() || self.render_xor.is_some().slice_bytesand enforceif depth > 1 && depth_pitch < slice_bytes { return Err(Error::TooSmall); }, matchingLayout::walk.crates/victory-core/src/config.rs(default_dir), filter empty env values with.filter(|v| !v.is_empty())forLOCALAPPDATA,XDG_CACHE_HOME, andHOME.victory-formats(forrender_xor->Err(Error::Unsupported)and overlapping 3Ddepth_pitch->Err(Error::TooSmall)) andvictory-core(for emptyLOCALAPPDATA/XDG_CACHE_HOME/HOME), and verify withcargo test --locked -p victory-formats -p victory-core.@github-actions[bot] on GitHub · 2026-12-02 09:14 UTC · original
Please attach both logs from the run that went wrong so we can investigate without guessing. Paste
%LOCALAPPDATA%into the File Explorer address bar to find them:%LOCALAPPDATA%\victory\logs\: the newest.logfrom that run (the console prints its path at startup on theLog: ...line).%LOCALAPPDATA%\victory\data\<TitleId>\crashes.log, and if present, the newest.crash.login%LOCALAPPDATA%\victory\data\<TitleId>\temp\.Please also include:
play-minivi.ps1preset, DLSS/FG/RT, customVICTORY_*vars) and commit SHA(Clean-room policy: please only attach text logs/screenshots — do not upload copyrighted game files or executables.)
github-bot referenced this issue2026-12-02 12:41:59 +00:00