You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a block header error is encountered, the vid_hdr value of the block is not set which leads to the exception you're seeing.
A fix to have a better error message would be:
diff --git a/ubireader/ubi/block/__init__.py b/ubireader/ubi/block/__init__.py
index ce80f96..ae66e35 100755
--- a/ubireader/ubi/block/__init__.py+++ b/ubireader/ubi/block/__init__.py@@ -62,7 +62,7 @@ class description(object):
# TODO better understanding of block types/errors
self.ec_hdr = ec_hdr(block_buf[0:UBI_EC_HDR_SZ])
- if not self.ec_hdr.errors or settings.ignore_block_header_errors:+ if not self.ec_hdr.errors or settings.ignore_block_header_errors or settings.warn_only_block_read_errors:
self.vid_hdr = vid_hdr(block_buf[self.ec_hdr.vid_hdr_offset:self.ec_hdr.vid_hdr_offset+UBI_VID_HDR_SZ])
if not self.vid_hdr.errors or settings.ignore_block_header_errors:
@@ -72,7 +72,8 @@ class description(object):
self.vtbl_recs = vtbl_recs(block_buf[self.ec_hdr.data_offset:])
self.leb_num = self.vid_hdr.lnum
-+ else:+ raise Exception("ECC error in block header. Use either --warn-only-block-read-errors or --ignore-block-header-errors.")
self.is_vtbl = bool(self.vtbl_recs) or False
self.is_valid = not self.ec_hdr.errors and not self.vid_hdr.errors or settings.ignore_block_header_errors
If you do apply that fix, or use ubireader with --ignore-block-header-errors you'll get this with your sample:
There appears to be a bug in the ubireader which checks for crc information in the header and fails to catch if it doesn't recognise it properly.
To Reproduce
Steps to reproduce the behavior:
unblob file.ubi
Detail
Error from unblob
Same error from ubireader as well.
Expected behavior
The script crash and fails to extract.
Environment information :
Linux arunmag 5.15.90.1-microsoft-standard-WSL2 onekey-sec/unblob#1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
"Ubuntu 22.04.1 LTS"
"unblob==23.4.17"
83886080-84803584.zip
The text was updated successfully, but these errors were encountered: