-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Description
There is a potential issue in do_resolve
, where we rebuild the return-value buffer each time on the stack:
backtrace-rs/src/symbolize/dbghelp.rs
Lines 220 to 232 in dccdb4d
unsafe fn do_resolve( | |
sym_from_addr: impl FnOnce(*mut SYMBOL_INFOW) -> BOOL, | |
get_line_from_addr: impl FnOnce(&mut IMAGEHLP_LINEW64) -> BOOL, | |
cb: &mut dyn FnMut(&super::Symbol), | |
) { | |
const SIZE: usize = 2 * MAX_SYM_NAME as usize + mem::size_of::<SYMBOL_INFOW>(); | |
let mut data = Aligned8([0u8; SIZE]); | |
let info = unsafe { &mut *data.0.as_mut_ptr().cast::<SYMBOL_INFOW>() }; | |
info.MaxNameLen = MAX_SYM_NAME as u32; | |
// the struct size in C. the value is different to | |
// `size_of::<SYMBOL_INFOW>() - MAX_SYM_NAME + 1` (== 81) | |
// due to struct alignment. | |
info.SizeOfStruct = 88; |
This sort of thing might happen elsewhere in the code, too.
We're not expected to be the fastest thing but if we find free performance lying on the floor, well, why not?
Noted in #737 (comment)
ChrisDenton
Metadata
Metadata
Assignees
Labels
No labels