diff --git a/cve_bin_tool/checkers/pcre2.py b/cve_bin_tool/checkers/pcre2.py index 298d0bd131..ce6e7ccd86 100644 --- a/cve_bin_tool/checkers/pcre2.py +++ b/cve_bin_tool/checkers/pcre2.py @@ -15,6 +15,13 @@ class Pcre2Checker(Checker): CONTAINS_PATTERNS: list[str] = [] - FILENAME_PATTERNS: list[str] = [] - VERSION_PATTERNS = [r"BSR_UNICODE\)\r?\n([0-9]+\.[0-9]+)"] + FILENAME_PATTERNS: list[str] = [r"pcre2"] + VERSION_PATTERNS = [ + r"BSR_UNICODE\)[\x00\r\n]+([0-9]+\.[0-9]+)", + r"DEFINE[\x00\r\n]+([0-9]+\.[0-9]+) [0-9]{4}-[0-9]{2}-[0-9]{2}", + r"([0-9]+\.[0-9]+) [0-9]{4}-[0-9]{2}-[0-9]{2}[\x00\r\n]+BSR_ANYCRLF", + r"Unicode not supported[\x00\r\n]+([0-9]+\.[0-9]+) [0-9]{4}-[0-9]{2}-[0-9]{2}", + r"BSR_ANYCRLF\)[\x00\r\n]+([0-9]+\.[0-9]+) [0-9]{4}-[0-9]{2}-[0-9]{2}", + r"NOTEMPTY_ATSTART\)[\x00\r\n]+([0-9]+\.[0-9]+) [0-9]{4}-[0-9]{2}-[0-9]{2}", + ] VENDOR_PRODUCT = [("pcre", "pcre2")] diff --git a/test/test_data/pcre2.py b/test/test_data/pcre2.py index 424b75f11c..1cf753014f 100644 --- a/test/test_data/pcre2.py +++ b/test/test_data/pcre2.py @@ -2,7 +2,41 @@ # SPDX-License-Identifier: GPL-3.0-or-later mapping_test_data = [ - {"product": "pcre2", "version": "10.22", "version_strings": ["BSR_UNICODE)\n10.22"]} + { + "product": "pcre2", + "version": "10.22", + "version_strings": ["BSR_UNICODE)\n10.22"], + }, + { + "product": "pcre2", + "version": "10.33", + "version_strings": ["DEFINE\n10.33 2019-04-16"], + }, + { + "product": "pcre2", + "version": "10.40", + "version_strings": ["10.40 2022-04-14\nBSR_ANYCRLF"], + }, + { + "product": "pcre2", + "version": "10.22", + "version_strings": ["Unicode not supported\x0010.22 2016-07-29"], + }, + { + "product": "pcre2", + "version": "10.32", + "version_strings": ["BSR_ANYCRLF)\x0010.32 2018-09-10"], + }, + { + "product": "pcre2", + "version": "10.33", + "version_strings": ["DEFINE\x0010.33 2019-04-16"], + }, + { + "product": "pcre2", + "version": "10.40", + "version_strings": ["NOTEMPTY_ATSTART)\x0010.40 2022-04-14"], + }, ] package_test_data = [ {