Skip to content

Commit 0b83800

Browse files
Expand take_nhdr doc-comment
1 parent 5d3bcc8 commit 0b83800

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/print/fuchsia.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ fn take_bytes_align4<'a>(num: usize, bytes: &mut &'a [u8]) -> Option<&'a [u8]> {
171171
Some(out)
172172
}
173173

174-
// This function has no invariants the caller must uphold, but it will return `None`
175-
// if 'bytes' is not correctly aligned. The values in the Elf_Nhdr fields might be
176-
// nonsense but this function ensures no such thing.
174+
/// This function has no invariants the caller must uphold, but
175+
/// it will return `None`, without mutating, if `bytes` has insufficient size or alignment.
176+
/// If this returns `Some(nhdr)`, then `bytes` was and remains 4-byte-aligned.
177+
/// The values in the Elf_Nhdr fields might be nonsense.
177178
fn take_nhdr<'a>(bytes: &mut &'a [u8]) -> Option<&'a Elf_Nhdr> {
178179
let (out, rest) = object::pod::from_bytes::<Elf_Nhdr>(bytes).ok()?;
179180
// Note that size_of::<Elf_Nhdr>() is always a multiple of 4-bytes, so the

0 commit comments

Comments
 (0)