Skip to content

Commit

Permalink
Merge pull request #829 from onekey-sec/zlib-force-start-offset
Browse files Browse the repository at this point in the history
fix(zlib): Limit zlib pattern at the start of the file
  • Loading branch information
qkaiser authored Apr 11, 2024
2 parents 92072fd + d2a1bdd commit 1f72c09
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 17 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions unblob/handlers/compression/zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from unblob.handlers.archive.dmg import DMGHandler

from ...file_utils import DEFAULT_BUFSIZE, InvalidInputFormat
from ...models import Extractor, File, Handler, HexString, ValidChunk
from ...models import Extractor, File, Handler, Regex, ValidChunk

logger = get_logger()

Expand All @@ -28,10 +28,10 @@ class ZlibHandler(Handler):
NAME = "zlib"

PATTERNS = [
HexString("78 01"), # low compression
HexString("78 9c"), # default compression
HexString("78 da"), # best compression
HexString("78 5e"), # compressed
Regex(r"^\x78\x01"), # low compression
Regex(r"^\x78\x9c"), # default compression
Regex(r"^\x78\xda"), # best compression
Regex(r"^\x78\x5e"), # compressed
]

EXTRACTOR = ZlibExtractor()
Expand Down

0 comments on commit 1f72c09

Please sign in to comment.