Skip to content

Commit 2c893d7

Browse files
committed
fix: update lz4 pattern for android
Add pattern to detect lz4 version in Android libraries. - Add FILENAME_PATTERNS to match liblz4 library files - Update VERSION_PATTERN to handle null byte separators (API 28) - Add generic ERROR_* pattern for API 30/34 format - Add test cases for Android lz4 formats Tested on Android API 28, 29, 30, 34 Partial fix for #5441
1 parent c264e0d commit 2c893d7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cve_bin_tool/checkers/lz4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Lz4Checker(Checker):
1919
FILENAME_PATTERNS: list[str] = [r"liblz4"]
2020
VERSION_PATTERNS = [
2121
r"lz4-([0-9]+\.[0-9]+\.[0-9]+)",
22-
r"([0-9]+\.[0-9]+\.[0-9]+)\r?\nUnspecified error code\r?\nOK_NoError",
22+
r"([0-9]+\.[0-9]+\.[0-9]+)[\x00\r\n]+Unspecified error code[\x00\r\n]+OK_NoError",
2323
r"ERROR_[a-zA-Z_]+[\x00\s]+([0-9]+\.[0-9]+\.[0-9]+)[\x00\s]+ERROR_[a-zA-Z_]+",
2424
]
2525
VENDOR_PRODUCT = [("lz4_project", "lz4"), ("yann_collet", "lz4")]

test/test_data/lz4.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"version": "1.9.3",
99
"version_strings": ["1.9.3\nUnspecified error code\nOK_NoError"],
1010
},
11+
{
12+
"product": "lz4",
13+
"version": "1.7.5",
14+
"version_strings": ["1.7.5\x00Unspecified error code\x00OK_NoError"],
15+
},
1116
{
1217
"product": "lz4",
1318
"version": "1.8.3",

0 commit comments

Comments
 (0)