[CFI] Skip zeros when entry length is zero
Only skip null bytes when format is Dwarf32
Remove skip_null
@@ -1016,6 +1016,7 @@ where
R: Reader,
Section: UnwindSection<R>,
{
+ let (offset, length, format) = loop {
let offset = input.offset_from(section.section());
let (length, format) = input.read_initial_length()?;
@@ -1023,6 +1024,16 @@ where
return Ok(None);
}
+ // Hack: skip zero padding inserted by buggy compilers/linkers.
+ // We require that the padding is a multiple of 32-bits, otherwise
+ // there is no reliable way to determine when the padding ends. This
+ // should be okay since CFI entries must be aligned to the address size.
+
+ if length.into_u64() != 0 || format != Format::Dwarf32 {
+ break (offset, length, format);
+ }
+ };
+
let mut rest = input.split(length)?;
let cie_offset_base = rest.offset_from(section.section());
let cie_id_or_offset = match Section::cie_offset_encoding(format) {
