Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cve_bin_tool/checkers/pcre2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
36 changes: 35 additions & 1 deletion test/test_data/pcre2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down