Skip to content

Commit

Permalink
Do not assume that the debug file string is as long as the array in w…
Browse files Browse the repository at this point in the history
…hich it is stored

This fixes issue #824
  • Loading branch information
gabrielesvelto committed Dec 7, 2023
1 parent 111dbbe commit 3c5309a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions symbolic-debuginfo/src/pe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,12 @@ impl<'data> PeObject<'data> {
.debug_data
.as_ref()
.and_then(|debug_data| debug_data.codeview_pdb70_debug_info.as_ref())
.map(|debug_info| {
String::from_utf8_lossy(&debug_info.filename[..debug_info.filename.len() - 1])
.and_then(|debug_info| {
debug_info
.filename
.iter()
.position(|&c| c == 0)
.map(|nul_byte| String::from_utf8_lossy(&debug_info.filename[..nul_byte]))
})
}

Expand Down

0 comments on commit 3c5309a

Please sign in to comment.