From 109ffae40bbc9d0a72896a85676134703ee08a30 Mon Sep 17 00:00:00 2001 From: Jack <72348727+Jack-GitHub12@users.noreply.github.com> Date: Thu, 11 Dec 2025 22:54:57 -0600 Subject: [PATCH] fix: update harfbuzz pattern for android (#5441) - Update existing VERSION_PATTERNS to support null byte separators (\x00) used in Android binaries - Add FILENAME_PATTERNS for libharfbuzz to improve file matching - Add 3 new patterns for different Android API versions: - API 28: HB_OPTIONS with invalid field - API 29: HB_OPTIONS without invalid field - API 30: json context pattern - API 34: morx table pattern - Add corresponding test data for Android versions 1.4.2, 2.3.0, 2.6.4, 6.0.0 Tested on Android APIs 28, 29, 30, and 34. Signed-off-by: Jack <72348727+Jack-GitHub12@users.noreply.github.com> --- cve_bin_tool/checkers/harfbuzz.py | 9 ++++++--- test/test_data/harfbuzz.py | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/cve_bin_tool/checkers/harfbuzz.py b/cve_bin_tool/checkers/harfbuzz.py index 653354c694..cce432a080 100644 --- a/cve_bin_tool/checkers/harfbuzz.py +++ b/cve_bin_tool/checkers/harfbuzz.py @@ -15,9 +15,12 @@ class HarfbuzzChecker(Checker): CONTAINS_PATTERNS: list[str] = [] - FILENAME_PATTERNS: list[str] = [] + FILENAME_PATTERNS: list[str] = [r"libharfbuzz"] VERSION_PATTERNS = [ - r"HB_OPTIONS\r?\nuniscribe-bug-compatible\r?\ninvalid\r?\n([0-9]+\.[0-9]+\.[0-9]+)", - r"([0-9]+\.[0-9]+\.[0-9]+)\r?\nHarfBuzz", + r"HB_OPTIONS[\x00\r\n]+uniscribe-bug-compatible[\x00\r\n]+invalid[\x00\r\n]+([0-9]+\.[0-9]+\.[0-9]+)", + r"([0-9]+\.[0-9]+\.[0-9]+)[\x00\r\n]+HarfBuzz", + r"HB_OPTIONS[\x00\r\n]+uniscribe-bug-compatible[\x00\r\n]+([0-9]+\.[0-9]+\.[0-9]+)", + r"json[\x00]+([0-9]+\.[0-9]+\.[0-9]+)[\x00]+iu[\x00]+ms", + r"end table morx[\x00]+([0-9]+\.[0-9]+\.[0-9]+)[\x00]+replacing glyph", ] VENDOR_PRODUCT = [("harfbuzz_project", "harfbuzz")] diff --git a/test/test_data/harfbuzz.py b/test/test_data/harfbuzz.py index 3111fcaff9..d9b4946a21 100644 --- a/test/test_data/harfbuzz.py +++ b/test/test_data/harfbuzz.py @@ -8,6 +8,28 @@ "version_strings": ["HB_OPTIONS\nuniscribe-bug-compatible\ninvalid\n7.0.0"], }, {"product": "harfbuzz", "version": "1.4.2", "version_strings": ["1.4.2\nHarfBuzz"]}, + { + "product": "harfbuzz", + "version": "1.4.2", + "version_strings": [ + "HB_OPTIONS\x00uniscribe-bug-compatible\x00invalid\x001.4.2" + ], + }, + { + "product": "harfbuzz", + "version": "2.3.0", + "version_strings": ["HB_OPTIONS\x00uniscribe-bug-compatible\x002.3.0"], + }, + { + "product": "harfbuzz", + "version": "2.6.4", + "version_strings": ["json\x002.6.4\x00iu\x00ms"], + }, + { + "product": "harfbuzz", + "version": "6.0.0", + "version_strings": ["end table morx\x006.0.0\x00replacing glyph"], + }, ] package_test_data = [ {