java-topology/defects/julia/patch/0001-isrelocatable-set-membership.patch

15 lines
821 B
Diff

# UNDF: UNDF-2026-000000130
--- a/base/loading.jl
+++ b/base/loading.jl
@@ -2100,8 +2100,11 @@ function isrelocatable(pkg::PkgId)
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Incompatible header in cache file $cachefile."))
_, (includes, includes_srcfiles, _), _... = _parse_cache_header(io, path)
+ # CWE-407 fix: build a Set for O(1) membership test instead of O(n) Vector scan
+ srcfiles_set = Set{String}(inc.filename for inc in includes_srcfiles)
for inc in includes
!startswith(inc.filename, "@depot") && return false
- if inc ∉ includes_srcfiles
+ if inc.filename ∉ srcfiles_set
# its an include_dependency
track_content = inc.mtime == -1.0
track_content || return false