diff --git a/cve_bin_tool/checkers/__init__.py b/cve_bin_tool/checkers/__init__.py index d00c2e6977..daf00a2d0e 100644 --- a/cve_bin_tool/checkers/__init__.py +++ b/cve_bin_tool/checkers/__init__.py @@ -66,6 +66,7 @@ "libxslt", "lighttpd", "logrotate", + "lua", "mariadb", "memcached", "mysql", diff --git a/cve_bin_tool/checkers/lua.py b/cve_bin_tool/checkers/lua.py new file mode 100644 index 0000000000..612bd3cdcb --- /dev/null +++ b/cve_bin_tool/checkers/lua.py @@ -0,0 +1,21 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: GPL-3.0-or-later + + +""" +CVE checker for lua + +https://www.cvedetails.com/product/28436/?q=LUA + +""" +from cve_bin_tool.checkers import Checker + + +class LuaChecker(Checker): + CONTAINS_PATTERNS = [ + r"PANIC: unprotected error in call to Lua API \(%s\)", + r"-o name output to file `name' \(default is \"luac.out\"\)", + ] + FILENAME_PATTERNS = [r"lua"] + VERSION_PATTERNS = [r"Lua ([0-9]+\.[0-9]+\.[0-9]+)"] + VENDOR_PRODUCT = [("lua", "lua")] diff --git a/test/condensed-downloads/lua50_5.0.3-8_arm64.deb.tar.gz b/test/condensed-downloads/lua50_5.0.3-8_arm64.deb.tar.gz new file mode 100644 index 0000000000..99ee5956b8 Binary files /dev/null and b/test/condensed-downloads/lua50_5.0.3-8_arm64.deb.tar.gz differ diff --git a/test/condensed-downloads/lua51-5.1.5-15.11.x86_64.rpm.tar.gz b/test/condensed-downloads/lua51-5.1.5-15.11.x86_64.rpm.tar.gz new file mode 100644 index 0000000000..8ac562855c Binary files /dev/null and b/test/condensed-downloads/lua51-5.1.5-15.11.x86_64.rpm.tar.gz differ diff --git a/test/test_data/lua.py b/test/test_data/lua.py new file mode 100644 index 0000000000..9a17c5c247 --- /dev/null +++ b/test/test_data/lua.py @@ -0,0 +1,37 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: GPL-3.0-or-later + +mapping_test_data = [ + { + "product": "lua", + "version": "5.1.5", + "version_strings": [ + "Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio", + "PANIC: unprotected error in call to Lua API (%s)", + '-o name output to file `name\' (default is "luac.out")', + ], + }, + { + "product": "lua", + "version": "5.0.3", + "version_strings": [ + "Lua 5.0.3 Copyright (C) 1994-2006 Tecgraf, PUC-Rio", + "PANIC: unprotected error in call to Lua API (%s)", + '-o name output to file `name\' (default is "luac.out")', + ], + }, +] +package_test_data = [ + { + "url": "https://ftp.lysator.liu.se/pub/opensuse/tumbleweed/repo/oss/x86_64/", + "package_name": "lua51-5.1.5-15.11.x86_64.rpm", + "product": "lua", + "version": "5.1.5", + }, + { + "url": "http://ports.ubuntu.com/pool/universe/l/lua50/", + "package_name": "lua50_5.0.3-8_arm64.deb", + "product": "lua", + "version": "5.0.3", + }, +]