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

stacktrace: prevent OOB-error in sysimage lookup #30369

Merged
merged 1 commit into from
Dec 17, 2018
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: 2 additions & 1 deletion src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,8 @@ static int jl_getDylibFunctionInfo(jl_frame_t **frames, size_t pointer, int skip
for (size_t i = 0; i < sysimg_fptrs.nclones; i++) {
if (diff == sysimg_fptrs.clone_offsets[i]) {
uint32_t idx = sysimg_fptrs.clone_idxs[i] & jl_sysimg_val_mask;
frame0->linfo = sysimg_fvars_linfo[idx];
if (idx < sysimg_fvars_n) // items after this were cloned but not referenced directly by a method (such as our ccall PLT thunks)
frame0->linfo = sysimg_fvars_linfo[idx];
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ static void jl_update_all_fptrs(jl_serializer_state *s)
for (i = 0; i < sysimg_fvars_max; i++) {
uintptr_t val = (uintptr_t)&linfos[i];
uint32_t offset = load_uint32(&val);
linfos[i] = NULL;
if (offset != 0) {
int specfunc = 1;
if (offset & ((uintptr_t)1 << (8 * sizeof(uint32_t) - 1))) {
Expand Down
4 changes: 2 additions & 2 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
# jump forward to the end of the inlining chain
# avoiding an extra (slow) lookup of `ip` in `lidict`
# and an extra chain of them in `down`
# note that we may even have this === parent (if we're ignoring this frame ip)
this = builder_value[fastkey]
let this = this
while this !== parent
Expand All @@ -532,8 +533,7 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
frame = (frames isa Vector ? frames[i] : frames)
!C && frame.from_c && continue
key = (T === UInt64 ? ip : frame)
down = parent.down
this = get!(down, key) do
this = get!(parent.down, key) do
return StackFrameTree{T}()
end
this.frame = frame
Expand Down