Skip to content

Commit

Permalink
[Update] Fix ROM Unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdWindScholar committed Feb 4, 2024
1 parent 805f033 commit 4085e3d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions ext4.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def get_block_count(self):
def get_info_list(self):
data = [
['Filesystem magic number', hex(self.superblock.s_magic).upper()],
["Filesystem volume name",self.superblock.s_volume_name.decode()],
["Filesystem volume name", self.superblock.s_volume_name.decode()],
["Filesystem UUID", self.uuid],
['Last mounted on', self.superblock.s_last_mounted.decode()],
["Block size", f"{1 << (10 + self.superblock.s_log_block_size)}"],
Expand Down Expand Up @@ -849,21 +849,21 @@ def xattrs(self, check_inline=True, check_block=True, force_inline=False):
if check_block and self.inode.i_file_acl != 0:
xattrs_block_start = self.inode.i_file_acl * self.volume.block_size
xattrs_block = self.volume.read(xattrs_block_start, self.volume.block_size)

xattrs_header = ext4_xattr_header.from_buffer_copy(xattrs_block)
if not self.volume.ignore_magic and xattrs_header.h_magic != 0xEA020000:
try:
raise MagicError(
f"Invalid magic value in xattrs block header at offset 0x{xattrs_block_start:X} of "
f"inode {self.inode_idx:d}: 0x{xattrs_header.h_magic} (expected 0xEA020000)"
)
except BaseException and Exception:
...

if xattrs_header.h_blocks != 1:
raise Ext4Error(
f"Invalid number of xattr blocks at offset 0x{xattrs_block_start:X} "
f"of inode {self.inode_idx:d}: {xattrs_header.h_blocks:d} (expected 1)")
if xattrs_block:
xattrs_header = ext4_xattr_header.from_buffer_copy(xattrs_block)
if not self.volume.ignore_magic and xattrs_header.h_magic != 0xEA020000:
try:
raise MagicError(
f"Invalid magic value in xattrs block header at offset 0x{xattrs_block_start:X} of "
f"inode {self.inode_idx:d}: 0x{xattrs_header.h_magic} (expected 0xEA020000)"
)
except BaseException and Exception:
...

if xattrs_header.h_blocks != 1:
raise Ext4Error(
f"Invalid number of xattr blocks at offset 0x{xattrs_block_start:X} "
f"of inode {self.inode_idx:d}: {xattrs_header.h_blocks:d} (expected 1)")

offset = 4 * ((ctypes.sizeof(
ext4_xattr_header) + 3) // 4)
Expand Down

0 comments on commit 4085e3d

Please sign in to comment.