Remove padding bytes risk in dbghelp with MaybeUninit
As reported in rust-lang/backtrace-rs#720, there is a risk that the current code, by using &mut to a struct with padding fields, interacts in ways that cause padding bytes to be written to what Rust originally thought were some real, initialized bytes, and that this may possibly cause some issue due to compiler misoptimizations.
This seems unlikely, but we can fix this by using MaybeUninit and then addressing the data using raw pointers only. That way, we do not have to depend on all the data being in initialized states even after calling SymFromAddrW. Except for the specific fields we read, of course.
合并状态:未合并 0 条评论