Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_block_data: use data_size for static volumes #100

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ubireader/ubi_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from ubireader.debug import error, log, verbose_log
from ubireader.ubi.block import sort
from ubireader.ubi.defines import UBI_VID_STATIC

class ubi_file(object):
"""UBI image file object
Expand Down Expand Up @@ -170,7 +171,10 @@ def read_block_data(self, block):
Obj:block -- Block data is desired for.
"""
self.seek(block.file_offset + block.ec_hdr.data_offset)
buf = self._fhandle.read(block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
if block.vid_hdr.vol_type == UBI_VID_STATIC:
buf = self._fhandle.read(block.vid_hdr.data_size)
else:
buf = self._fhandle.read(block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
return buf


Expand Down