Skip to content

Commit 04d3015

Browse files
khueyoli-obk
authored andcommitted
Correctly handle compressed .debug_str_offsets.
Thorin needs to pass the *decompressed* size to remap_str_offsets_section or the .debug_str_offsets section will be unexpectedly truncated if it was compressed.
1 parent 142ee98 commit 04d3015

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

thorin/src/package.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,17 @@ impl<'file> InProgressDwarfPackage<'file> {
491491
update!(debug_rnglists += self.obj.append_to_debug_rnglists(&data));
492492
}
493493
Ok(".debug_str_offsets.dwo" | ".zdebug_str_offsets.dwo") => {
494-
let debug_str_offsets_section = {
494+
let (debug_str_offsets_section, debug_str_offsets_section_len) = {
495495
let data = section.compressed_data()?.decompress()?;
496+
let len = data.len() as u64;
496497
let data_ref = sess.alloc_owned_cow(data);
497-
gimli::DebugStrOffsets::from(gimli::EndianSlice::new(data_ref, self.endian))
498+
(
499+
gimli::DebugStrOffsets::from(gimli::EndianSlice::new(
500+
data_ref,
501+
self.endian,
502+
)),
503+
len,
504+
)
498505
};
499506

500507
let debug_str_section =
@@ -509,7 +516,7 @@ impl<'file> InProgressDwarfPackage<'file> {
509516
let data = self.string_table.remap_str_offsets_section(
510517
debug_str_section,
511518
debug_str_offsets_section,
512-
section.size(),
519+
debug_str_offsets_section_len,
513520
self.endian,
514521
encoding,
515522
)?;

0 commit comments

Comments
 (0)