Skip to content

Commit

Permalink
[Serialization] fix format bug for pre_13 code
Browse files Browse the repository at this point in the history
pre_13 would fail to read the max_world field, resulting in the stream
getting desynchronized and corrupted. Add some type-asserts to help
detect that error earlier.
  • Loading branch information
vtjnash authored and mkitti committed Mar 7, 2024
1 parent 337623e commit 4453b0d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions stdlib/Serialization/src/Serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1214,24 +1214,25 @@ function deserialize(s::AbstractSerializer, ::Type{CodeInfo})
deserialize(s) # rettype
ci.parent = deserialize(s)
world_or_edges = deserialize(s)
pre_13 = isa(world_or_edges, Integer)
pre_13 = isa(world_or_edges, Union{UInt, Int})
if pre_13
ci.min_world = world_or_edges
ci.min_world = reinterpret(UInt, world_or_edges)
ci.max_world = reinterpret(UInt, deserialize(s))
else
ci.edges = world_or_edges
ci.min_world = reinterpret(UInt, deserialize(s))
ci.max_world = reinterpret(UInt, deserialize(s))
ci.min_world = deserialize(s)::UInt
ci.max_world = deserialize(s)::UInt
end
else
ci.parent = deserialize(s)
ci.method_for_inference_limit_heuristics = deserialize(s)
ci.edges = deserialize(s)
ci.min_world = reinterpret(UInt, deserialize(s))
ci.max_world = reinterpret(UInt, deserialize(s))
ci.min_world = deserialize(s)::UInt
ci.max_world = deserialize(s)::UInt
end
end
if format_version(s) <= 26
deserialize(s) # inferred
deserialize(s)::Bool # inferred
end
if format_version(s) < 22
inlining_cost = deserialize(s)
Expand Down

0 comments on commit 4453b0d

Please sign in to comment.