From 7a67112e91f437a07d1234402e2742ae7470a632 Mon Sep 17 00:00:00 2001 From: aivanov Date: Thu, 20 Jun 2024 22:44:52 +0100 Subject: [PATCH 1/2] Fix frame_content_size retrieval logic --- unblob/handlers/compression/zstd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unblob/handlers/compression/zstd.py b/unblob/handlers/compression/zstd.py index 1bd59d3d62..bf92629aab 100644 --- a/unblob/handlers/compression/zstd.py +++ b/unblob/handlers/compression/zstd.py @@ -29,7 +29,7 @@ class ZSTDHandler(Handler): def get_frame_header_size(self, frame_header_descriptor: int) -> int: single_segment = (frame_header_descriptor >> 5 & 1) & 0b1 dictionary_id = frame_header_descriptor >> 0 & 0b11 - frame_content_size = (frame_header_descriptor >> 6) & 0b1 + frame_content_size = (frame_header_descriptor >> 6) & 0b11 return ( int(not single_segment) + DICT_ID_FIELDSIZE_MAP[dictionary_id] From b76d1b487a449498ad29abb03a88f42ca673aaa1 Mon Sep 17 00:00:00 2001 From: aivanov Date: Thu, 20 Jun 2024 22:44:52 +0100 Subject: [PATCH 2/2] fix(zstd): fix frame_content_size retrieval logic --- tests/integration/compression/zstd/__input__/large_fcs.zstd | 3 +++ .../zstd/__output__/large_fcs.zstd_extract/zstd.uncompressed | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 tests/integration/compression/zstd/__input__/large_fcs.zstd create mode 100644 tests/integration/compression/zstd/__output__/large_fcs.zstd_extract/zstd.uncompressed diff --git a/tests/integration/compression/zstd/__input__/large_fcs.zstd b/tests/integration/compression/zstd/__input__/large_fcs.zstd new file mode 100644 index 0000000000..8dd035cd2c --- /dev/null +++ b/tests/integration/compression/zstd/__input__/large_fcs.zstd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c6fc92dda937dd453b83c60f0d439c87a156d09888ede3d47201e13c26245e8 +size 26 diff --git a/tests/integration/compression/zstd/__output__/large_fcs.zstd_extract/zstd.uncompressed b/tests/integration/compression/zstd/__output__/large_fcs.zstd_extract/zstd.uncompressed new file mode 100644 index 0000000000..caefa0b5fe --- /dev/null +++ b/tests/integration/compression/zstd/__output__/large_fcs.zstd_extract/zstd.uncompressed @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cc43248c8a1245d2dc0d1e6a2fb9935d3506689bd8abd037f040af136dc0269 +size 65792