Skip to content

fix(fspy): handle null ObjectName and correct absolute path logic on Windows#92

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-ci-failure
Closed

fix(fspy): handle null ObjectName and correct absolute path logic on Windows#92
Copilot wants to merge 2 commits intomainfrom
copilot/fix-ci-failure

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 11, 2026

Fixes Windows crash when running oxlint with --type-aware flag and cache invalidation failures. The crash occurred due to null pointer dereference in UNICODE_STRING handling. The cache failures occurred because the inverted absolute path logic prevented proper directory tracking.

Changes

Path resolution (convert.rs)

  • Fixed inverted logic: relative paths now combine with RootDirectory, absolute paths pass through
  • Changed absolute path check from \\ (UNC) to \ (device-relative paths)
  • Handle null ObjectName by checking reference before dereferencing
  • When ObjectName is empty, return RootDirectory path directly instead of calling PathAllocCombine

UNICODE_STRING handling (winapi_utils.rs)

  • Interpret Length field as bytes (was incorrectly treated as u16 count)
  • Handle null/empty Buffer by returning empty slice instead of creating invalid pointer

Symbol resolution (detour.rs, nt.rs)

  • Add ntdll to dynamic symbol lookup (kernel32 → ntdll fallback)
  • Add NtQueryDirectoryFileEx detour for directory enumeration on newer Windows

Test updates

  • Create directories before testing readdir operations (Windows requires directory exists to distinguish READ vs READ_DIR access)
  • Add PATH setup for oxlint to find tsgolint subprocess
  • Add oxlint_type_aware test case

Example

Before (crash or wrong path):

let filename_str = unsafe { get_u16_str(&*(*self).ObjectName) }; // Crash if null
let is_absolute = /* UNC check */;
if is_absolute { /* combine - wrong! */ }

After (safe and correct):

let filename_str = if let Some(object_name) = unsafe { (*self).ObjectName.as_ref() } {
    unsafe { get_u16_str(object_name) }
} else {
    U16Str::from_slice(&[]) // Empty when null
};
let is_absolute = filename_slice.get(0) == Some(&b'\\'.into()) || /* drive */;
if !is_absolute { /* combine - correct! */ }
if filename_slice.is_empty() { return root_dir; } // Direct return for empty
Original prompt

Fix the CI failure in #91


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: branchseer <3612422+branchseer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI failure in pull request 91 fix(fspy): handle null ObjectName and correct absolute path logic on Windows Jan 11, 2026
Copilot AI requested a review from branchseer January 11, 2026 13:32
@branchseer branchseer closed this Jan 11, 2026
@branchseer branchseer deleted the copilot/fix-ci-failure branch January 11, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants