Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #611 new version 0.5.7 #612

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.5.7
- Fix edge case for uninitialized Vlens

## 0.5.6
- Add Aqua tests and eliminate method ambiguities

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "JLD2"
uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
version = "0.5.6"
version = "0.5.7"

[deps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Expand Down
2 changes: 1 addition & 1 deletion src/data/writing_datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ h5convert_uninitialized!(out::Pointers, odr::Type{T}) where {T<:Vlen} =
# Read variable-length data given offset and length in ptr
jlconvert(::MappedRepr{T,Vlen{S}}, f::JLDFile, ptr::Ptr, ::RelOffset) where {T,S} =
read_heap_object(f, jlunsafe_load(pconvert(Ptr{GlobalHeapID}, ptr+4)), ReadRepresentation(T, S))
jlconvert_canbeuninitialized(::MappedRepr{<: Type, <: Vlen}) = true
jlconvert_canbeuninitialized(::MappedRepr{<: Any, <: Vlen}) = true
jlconvert_isinitialized(::MappedRepr{T,Vlen{S}}, ptr::Ptr) where {T,S} =
jlunsafe_load(pconvert(Ptr{GlobalHeapID}, ptr+4)) != GlobalHeapID(RelOffset(0), 0)

Expand Down
10 changes: 10 additions & 0 deletions test/loadsave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -837,4 +837,14 @@ end
end
end
recursive_test(obj, res)
end

@testset "Issue #611 - non-initialized Symbol field" begin
fn = joinpath(mktempdir(), "non-init-symbolfield.jld2")
data = Vector{Symbol}(undef, 2)
data[1] = :a
jldsave(fn; data)
loaded_data = load(fn, "data")
@test !isassigned(loaded_data, 2)
@test loaded_data[1] == :a
end
Loading