Skip to content

Commit

Permalink
fix #611
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasIsensee committed Oct 24, 2024
1 parent 0ead579 commit db264d1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
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

0 comments on commit db264d1

Please sign in to comment.