Skip to content

Commit

Permalink
Merge pull request #86 from onekey-sec/fix-lzo
Browse files Browse the repository at this point in the history
Fix LZO decompression after switching to lzallright
  • Loading branch information
qkaiser authored May 29, 2023
2 parents 479646d + 82fb82c commit 6d61a6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ubireader/ubifs/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################

from lzallright.lzallright import LZOCompressor as lzo
from lzallright import LZOCompressor, LZOError
import struct
import zlib
from ubireader.ubifs.defines import *
Expand Down Expand Up @@ -62,7 +62,7 @@ def decompress(ctype, unc_len, data):
"""
if ctype == UBIFS_COMPR_LZO:
try:
return lzo.decompress(b''.join((b'\xf0', struct.pack('>I', unc_len), data)))
return LZOCompressor.decompress(data, output_size_hint=unc_len)
except Exception as e:
error(decompress, 'Warn', 'LZO Error: %s' % e)
elif ctype == UBIFS_COMPR_ZLIB:
Expand Down

0 comments on commit 6d61a6d

Please sign in to comment.