diff --git a/src/pxar/decoder.rs b/src/pxar/decoder.rs index 767cc8b3..e21f3bf2 100644 --- a/src/pxar/decoder.rs +++ b/src/pxar/decoder.rs @@ -345,6 +345,11 @@ impl Result<(), Error>> Decoder { /// returned. pub fn read(&mut self, offset: u64, size: usize, data_offset: u64) -> Result, Error> { self.seek(SeekFrom::Start(offset))?; + let head: PxarHeader = self.inner.read_item()?; + if head.htype != PXAR_FILENAME { + bail!("Expected PXAR_FILENAME, encountered 0x{:x?}", head.htype); + } + let _filename = self.inner.read_filename(head.size)?; let head: PxarHeader = self.inner.read_item()?; check_ca_header::(&head, PXAR_ENTRY)?;