Libarchive's archive_read_data_block() does not guarantee that the returned block continues at the byte offset where the last block finished. It explicitely allows for gaps in order to efficiently handle sparse files. To correctly handle this case the offset returned by archive_read_data_block() should also be returned by read_block().