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 cb6d139
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Unreleased

**Internal**

**Fixes**

- Fix an issue when extracting the name of the debug file from a PE object ([#825](https://github.com/getsentry/symbolic/pull/825))

**Features**

## 12.8.0

**Internal**
Expand Down
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 cb6d139

Please sign in to comment.