diff --git a/CHANGELOG.md b/CHANGELOG.md index 89bf05b6..48c32809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.7 + - Fix edge case for uninitialized Vlens + ## 0.5.6 - Add Aqua tests and eliminate method ambiguities diff --git a/Project.toml b/Project.toml index 05be4ca1..00cad207 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/data/writing_datatypes.jl b/src/data/writing_datatypes.jl index cf80bfb4..f45ea8d2 100644 --- a/src/data/writing_datatypes.jl +++ b/src/data/writing_datatypes.jl @@ -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) diff --git a/test/loadsave.jl b/test/loadsave.jl index 4684601b..5b3decaf 100644 --- a/test/loadsave.jl +++ b/test/loadsave.jl @@ -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 \ No newline at end of file