summaryrefslogtreecommitdiffstats
path: root/vendor/object/src/read/xcoff/section.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/object/src/read/xcoff/section.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/object/src/read/xcoff/section.rs')
-rw-r--r--vendor/object/src/read/xcoff/section.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/object/src/read/xcoff/section.rs b/vendor/object/src/read/xcoff/section.rs
index 0944e10c8..77453fcd2 100644
--- a/vendor/object/src/read/xcoff/section.rs
+++ b/vendor/object/src/read/xcoff/section.rs
@@ -36,7 +36,7 @@ where
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(|(index, section)| XcoffSection {
- index: SectionIndex(index),
+ index: SectionIndex(index + 1),
file: self.file,
section,
})
@@ -54,7 +54,6 @@ pub type XcoffSection64<'data, 'file, R = &'data [u8]> =
#[derive(Debug)]
pub struct XcoffSection<'data, 'file, Xcoff, R = &'data [u8]>
where
- 'data: 'file,
Xcoff: FileHeader,
R: ReadRef<'data>,
{
@@ -252,9 +251,11 @@ where
}
/// Return the section header at the given index.
+ ///
+ /// The index is 1-based.
pub fn section(&self, index: SectionIndex) -> read::Result<&'data Xcoff::SectionHeader> {
self.sections
- .get(index.0)
+ .get(index.0.wrapping_sub(1))
.read_error("Invalid XCOFF section index")
}
}