Skip to content

Commit

Permalink
Fix stack-use-after-scope in typemap
Browse files Browse the repository at this point in the history
The value `a` is referenced in a GC frame past its liftetime. In
practice this probably causes few issues, but in theory, the
compiler is allowed to start scribbling garbage into the stack
slot as soon as it goes out of scope. Asan complains about this
(correctly).
  • Loading branch information
Keno committed Aug 11, 2022
1 parent 61f58be commit 854519c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/typemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,13 @@ int jl_typemap_visitor(jl_typemap_t *cache, jl_typemap_visitor_fptr fptr, void *
goto exit;
JL_GC_POP();
return 1;
exit:
JL_GC_POP();
return 0;
}
else {
return jl_typemap_node_visitor((jl_typemap_entry_t*)cache, fptr, closure);
}

exit:
JL_GC_POP();
return 0;
}

static unsigned jl_supertype_height(jl_datatype_t *dt)
Expand Down

0 comments on commit 854519c

Please sign in to comment.