mirror of
https://git.yoctoproject.org/poky
synced 2026-02-21 08:59:41 +01:00
Compare commits
55 Commits
yocto-3.1.
...
yocto-3.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e298a4222 | ||
|
|
bb6c7e09e3 | ||
|
|
86146334f1 | ||
|
|
898aedf585 | ||
|
|
cc3cefdb43 | ||
|
|
b0cff6d434 | ||
|
|
08fb6eb2e0 | ||
|
|
34aaa93bfe | ||
|
|
c2bd2eae86 | ||
|
|
396373610c | ||
|
|
38b588a1a1 | ||
|
|
f0d18846de | ||
|
|
d6941efc0b | ||
|
|
df1129b022 | ||
|
|
0ca0aec7aa | ||
|
|
0f83e5bd42 | ||
|
|
475b0d3fad | ||
|
|
232b5533de | ||
|
|
b4e5bf3e7f | ||
|
|
e8255f5086 | ||
|
|
afc8929c5b | ||
|
|
72385662c8 | ||
|
|
5c61613405 | ||
|
|
dfd1497961 | ||
|
|
5999f70889 | ||
|
|
37bbb105c9 | ||
|
|
fec7f76cfc | ||
|
|
61c36064c8 | ||
|
|
a48231b5bf | ||
|
|
a75678145b | ||
|
|
31970fb2a4 | ||
|
|
6327db048b | ||
|
|
c408846f41 | ||
|
|
49cd9f898f | ||
|
|
46e00399e5 | ||
|
|
2120a39b09 | ||
|
|
dd76704ea5 | ||
|
|
66b0097533 | ||
|
|
24f305b4dd | ||
|
|
d68406497e | ||
|
|
5daf9735c9 | ||
|
|
de24466823 | ||
|
|
a03e13a00b | ||
|
|
eba0e64a88 | ||
|
|
3a9cef8dbe | ||
|
|
90cf135b04 | ||
|
|
e47d35353c | ||
|
|
b4ba37ce13 | ||
|
|
4dfdb53c8a | ||
|
|
64f632c93f | ||
|
|
319ca9f460 | ||
|
|
dcd40cfa37 | ||
|
|
5b0093ecee | ||
|
|
49032f1e8d | ||
|
|
86cdd92b15 |
@@ -4967,7 +4967,7 @@ configuration would be as follows:
|
||||
require conf/multilib.conf
|
||||
MULTILIBS = "multilib:lib32"
|
||||
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
|
||||
IMAGE_INSTALL_append = "lib32-glib-2.0"
|
||||
IMAGE_INSTALL_append = " lib32-glib-2.0"
|
||||
|
||||
This example enables an additional library named
|
||||
``lib32`` alongside the normal target packages. When combining these
|
||||
|
||||
@@ -1100,7 +1100,7 @@ Section.
|
||||
::
|
||||
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
SRC_URI_append = "file://0001-calibrate.c-Added-some-printk-statements.patch"
|
||||
SRC_URI_append = " file://0001-calibrate.c-Added-some-printk-statements.patch"
|
||||
|
||||
The :term:`FILESEXTRAPATHS` and :term:`SRC_URI` statements
|
||||
enable the OpenEmbedded build system to find the patch file.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.16"
|
||||
DISTRO : "3.1.17"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.16"
|
||||
YOCTO_DOC_VERSION : "3.1.17"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.16"
|
||||
DOCCONF_VERSION : "3.1.16"
|
||||
DISTRO_REL_TAG : "yocto-3.1.17"
|
||||
DOCCONF_VERSION : "3.1.17"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.16"
|
||||
POKYVERSION : "23.0.17"
|
||||
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
|
||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||
|
||||
@@ -3846,10 +3846,10 @@ system and gives an overview of their function and contents.
|
||||
::
|
||||
|
||||
KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/taskstats/taskstats.scc"
|
||||
KERNEL_FEATURES_append = "${KERNEL_EXTRA_FEATURES}"
|
||||
KERNEL_FEATURES_append_qemuall = "cfg/virtio.scc"
|
||||
KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
|
||||
KERNEL_FEATURES_append_qemuall = " cfg/virtio.scc"
|
||||
KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc cfg/paravirt_kvm.scc"
|
||||
KERNEL_FEATURES_append_qemux86-64 = "cfg/sound.scc"
|
||||
KERNEL_FEATURES_append_qemux86-64 = " cfg/sound.scc"
|
||||
|
||||
:term:`KERNEL_FIT_LINK_NAME`
|
||||
The link name of the kernel flattened image tree (FIT) image. This
|
||||
@@ -4048,7 +4048,7 @@ system and gives an overview of their function and contents.
|
||||
SRCREV_machine_core2-32-intel-common = "43b9eced9ba8a57add36af07736344dcc383f711"
|
||||
KMACHINE_core2-32-intel-common = "intel-core2-32"
|
||||
KBRANCH_core2-32-intel-common = "standard/base"
|
||||
KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
|
||||
KERNEL_FEATURES_append_core2-32-intel-common = " ${KERNEL_FEATURES_INTEL_COMMON}"
|
||||
|
||||
The ``KMACHINE`` statement says
|
||||
that the kernel understands the machine name as "intel-core2-32".
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "3.1.16"
|
||||
DISTRO_VERSION = "3.1.17"
|
||||
DISTRO_CODENAME = "dunfell"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
|
||||
@@ -122,6 +122,10 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
|
||||
tools = d.getVar(toolsvar).split()
|
||||
origbbenv = d.getVar("BB_ORIGENV", False)
|
||||
path = origbbenv.getVar("PATH")
|
||||
# Need to ignore our own scripts directories to avoid circular links
|
||||
for p in path.split(":"):
|
||||
if p.endswith("/scripts"):
|
||||
path = path.replace(p, "/ignoreme")
|
||||
bb.utils.mkdirhier(dest)
|
||||
notfound = []
|
||||
for tool in tools:
|
||||
|
||||
@@ -34,14 +34,27 @@ CVE_CHECK_TMP_FILE ?= "${TMPDIR}/cve_check"
|
||||
CVE_CHECK_SUMMARY_DIR ?= "${LOG_DIR}/cve"
|
||||
CVE_CHECK_SUMMARY_FILE_NAME ?= "cve-summary"
|
||||
CVE_CHECK_SUMMARY_FILE ?= "${CVE_CHECK_SUMMARY_DIR}/${CVE_CHECK_SUMMARY_FILE_NAME}"
|
||||
CVE_CHECK_SUMMARY_FILE_NAME_JSON = "cve-summary.json"
|
||||
CVE_CHECK_SUMMARY_INDEX_PATH = "${CVE_CHECK_SUMMARY_DIR}/cve-summary-index.txt"
|
||||
|
||||
CVE_CHECK_LOG_JSON ?= "${T}/cve.json"
|
||||
|
||||
CVE_CHECK_DIR ??= "${DEPLOY_DIR}/cve"
|
||||
CVE_CHECK_RECIPE_FILE ?= "${CVE_CHECK_DIR}/${PN}"
|
||||
CVE_CHECK_RECIPE_FILE_JSON ?= "${CVE_CHECK_DIR}/${PN}_cve.json"
|
||||
CVE_CHECK_MANIFEST ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cve"
|
||||
CVE_CHECK_MANIFEST_JSON ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.json"
|
||||
CVE_CHECK_COPY_FILES ??= "1"
|
||||
CVE_CHECK_CREATE_MANIFEST ??= "1"
|
||||
|
||||
CVE_CHECK_REPORT_PATCHED ??= "1"
|
||||
CVE_CHECK_SHOW_WARNINGS ??= "1"
|
||||
|
||||
# Provide text output
|
||||
CVE_CHECK_FORMAT_TEXT ??= "1"
|
||||
|
||||
# Provide JSON output - disabled by default for backward compatibility
|
||||
CVE_CHECK_FORMAT_JSON ??= "0"
|
||||
|
||||
# Whitelist for packages (PN)
|
||||
CVE_CHECK_PN_WHITELIST ?= ""
|
||||
@@ -63,6 +76,33 @@ CVE_CHECK_LAYER_INCLUDELIST ??= ""
|
||||
# set to "alphabetical" for version using single alphabetical character as increment release
|
||||
CVE_VERSION_SUFFIX ??= ""
|
||||
|
||||
def update_symlinks(target_path, link_path):
|
||||
if link_path != target_path and os.path.exists(target_path):
|
||||
if os.path.exists(os.path.realpath(link_path)):
|
||||
os.remove(link_path)
|
||||
os.symlink(os.path.basename(target_path), link_path)
|
||||
|
||||
def generate_json_report(d, out_path, link_path):
|
||||
if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")):
|
||||
import json
|
||||
from oe.cve_check import cve_check_merge_jsons
|
||||
|
||||
bb.note("Generating JSON CVE summary")
|
||||
index_file = d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")
|
||||
summary = {"version":"1", "package": []}
|
||||
with open(index_file) as f:
|
||||
filename = f.readline()
|
||||
while filename:
|
||||
with open(filename.rstrip()) as j:
|
||||
data = json.load(j)
|
||||
cve_check_merge_jsons(summary, data)
|
||||
filename = f.readline()
|
||||
|
||||
with open(out_path, "w") as f:
|
||||
json.dump(summary, f, indent=2)
|
||||
|
||||
update_symlinks(out_path, link_path)
|
||||
|
||||
python cve_save_summary_handler () {
|
||||
import shutil
|
||||
import datetime
|
||||
@@ -78,13 +118,15 @@ python cve_save_summary_handler () {
|
||||
|
||||
if os.path.exists(cve_tmp_file):
|
||||
shutil.copyfile(cve_tmp_file, cve_summary_file)
|
||||
cvefile_link = os.path.join(cvelogpath, cve_summary_name)
|
||||
update_symlinks(cve_summary_file, cvefile_link)
|
||||
bb.plain("Complete CVE report summary created at: %s" % cvefile_link)
|
||||
|
||||
if cve_summary_file and os.path.exists(cve_summary_file):
|
||||
cvefile_link = os.path.join(cvelogpath, cve_summary_name)
|
||||
|
||||
if os.path.exists(os.path.realpath(cvefile_link)):
|
||||
os.remove(cvefile_link)
|
||||
os.symlink(os.path.basename(cve_summary_file), cvefile_link)
|
||||
if d.getVar("CVE_CHECK_FORMAT_JSON") == "1":
|
||||
json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON"))
|
||||
json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp))
|
||||
generate_json_report(d, json_summary_name, json_summary_link_name)
|
||||
bb.plain("Complete CVE JSON report summary created at: %s" % json_summary_link_name)
|
||||
}
|
||||
|
||||
addhandler cve_save_summary_handler
|
||||
@@ -109,7 +151,7 @@ python do_cve_check () {
|
||||
|
||||
}
|
||||
|
||||
addtask cve_check before do_build after do_fetch
|
||||
addtask cve_check before do_build
|
||||
do_cve_check[depends] = "cve-update-db-native:do_fetch"
|
||||
do_cve_check[nostamp] = "1"
|
||||
|
||||
@@ -118,6 +160,7 @@ python cve_check_cleanup () {
|
||||
Delete the file used to gather all the CVE information.
|
||||
"""
|
||||
bb.utils.remove(e.data.getVar("CVE_CHECK_TMP_FILE"))
|
||||
bb.utils.remove(e.data.getVar("CVE_CHECK_SUMMARY_INDEX_PATH"))
|
||||
}
|
||||
|
||||
addhandler cve_check_cleanup
|
||||
@@ -129,33 +172,80 @@ python cve_check_write_rootfs_manifest () {
|
||||
"""
|
||||
|
||||
import shutil
|
||||
import json
|
||||
from oe.rootfs import image_list_installed_packages
|
||||
from oe.cve_check import cve_check_merge_jsons
|
||||
|
||||
if d.getVar("CVE_CHECK_COPY_FILES") == "1":
|
||||
deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE")
|
||||
if os.path.exists(deploy_file):
|
||||
bb.utils.remove(deploy_file)
|
||||
deploy_file_json = d.getVar("CVE_CHECK_RECIPE_FILE_JSON")
|
||||
if os.path.exists(deploy_file_json):
|
||||
bb.utils.remove(deploy_file_json)
|
||||
|
||||
if os.path.exists(d.getVar("CVE_CHECK_TMP_FILE")):
|
||||
bb.note("Writing rootfs CVE manifest")
|
||||
deploy_dir = d.getVar("DEPLOY_DIR_IMAGE")
|
||||
link_name = d.getVar("IMAGE_LINK_NAME")
|
||||
# Create a list of relevant recipies
|
||||
recipies = set()
|
||||
for pkg in list(image_list_installed_packages(d)):
|
||||
pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
|
||||
'runtime-reverse', pkg)
|
||||
pkg_data = oe.packagedata.read_pkgdatafile(pkg_info)
|
||||
recipies.add(pkg_data["PN"])
|
||||
|
||||
bb.note("Writing rootfs CVE manifest")
|
||||
deploy_dir = d.getVar("DEPLOY_DIR_IMAGE")
|
||||
link_name = d.getVar("IMAGE_LINK_NAME")
|
||||
|
||||
json_data = {"version":"1", "package": []}
|
||||
text_data = ""
|
||||
enable_json = d.getVar("CVE_CHECK_FORMAT_JSON") == "1"
|
||||
enable_text = d.getVar("CVE_CHECK_FORMAT_TEXT") == "1"
|
||||
|
||||
save_pn = d.getVar("PN")
|
||||
|
||||
for pkg in recipies:
|
||||
# To be able to use the CVE_CHECK_RECIPE_FILE variable we have to evaluate
|
||||
# it with the different PN names set each time.
|
||||
d.setVar("PN", pkg)
|
||||
if enable_text:
|
||||
pkgfilepath = d.getVar("CVE_CHECK_RECIPE_FILE")
|
||||
if os.path.exists(pkgfilepath):
|
||||
with open(pkgfilepath) as pfile:
|
||||
text_data += pfile.read()
|
||||
|
||||
if enable_json:
|
||||
pkgfilepath = d.getVar("CVE_CHECK_RECIPE_FILE_JSON")
|
||||
if os.path.exists(pkgfilepath):
|
||||
with open(pkgfilepath) as j:
|
||||
data = json.load(j)
|
||||
cve_check_merge_jsons(json_data, data)
|
||||
|
||||
d.setVar("PN", save_pn)
|
||||
|
||||
if enable_text:
|
||||
link_path = os.path.join(deploy_dir, "%s.cve" % link_name)
|
||||
manifest_name = d.getVar("CVE_CHECK_MANIFEST")
|
||||
cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE")
|
||||
|
||||
bb.utils.mkdirhier(os.path.dirname(manifest_name))
|
||||
shutil.copyfile(cve_tmp_file, manifest_name)
|
||||
with open(manifest_name, "w") as f:
|
||||
f.write(text_data)
|
||||
|
||||
if manifest_name and os.path.exists(manifest_name):
|
||||
manifest_link = os.path.join(deploy_dir, "%s.cve" % link_name)
|
||||
# If we already have another manifest, update symlinks
|
||||
if os.path.exists(os.path.realpath(manifest_link)):
|
||||
os.remove(manifest_link)
|
||||
os.symlink(os.path.basename(manifest_name), manifest_link)
|
||||
bb.plain("Image CVE report stored in: %s" % manifest_name)
|
||||
update_symlinks(manifest_name, link_path)
|
||||
bb.plain("Image CVE report stored in: %s" % manifest_name)
|
||||
|
||||
if enable_json:
|
||||
link_path = os.path.join(deploy_dir, "%s.json" % link_name)
|
||||
manifest_name = d.getVar("CVE_CHECK_MANIFEST_JSON")
|
||||
|
||||
with open(manifest_name, "w") as f:
|
||||
json.dump(json_data, f, indent=2)
|
||||
|
||||
update_symlinks(manifest_name, link_path)
|
||||
bb.plain("Image CVE JSON report stored in: %s" % manifest_name)
|
||||
}
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND_prepend = "${@'cve_check_write_rootfs_manifest; ' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}"
|
||||
do_rootfs[recrdeptask] += "${@'do_cve_check' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}"
|
||||
do_populate_sdk[recrdeptask] += "${@'do_cve_check' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}"
|
||||
|
||||
def get_patches_cves(d):
|
||||
"""
|
||||
@@ -337,7 +427,7 @@ def get_cve_info(d, cves):
|
||||
conn.close()
|
||||
return cve_data
|
||||
|
||||
def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
|
||||
def cve_write_data_text(d, patched, unpatched, whitelisted, cve_data):
|
||||
"""
|
||||
Write CVE information in WORKDIR; and to CVE_CHECK_DIR, and
|
||||
CVE manifest if enabled.
|
||||
@@ -383,7 +473,7 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
|
||||
write_string += "VECTOR: %s\n" % cve_data[cve]["vector"]
|
||||
write_string += "MORE INFORMATION: %s%s\n\n" % (nvd_link, cve)
|
||||
|
||||
if unpatched_cves:
|
||||
if unpatched_cves and d.getVar("CVE_CHECK_SHOW_WARNINGS") == "1":
|
||||
bb.warn("Found unpatched CVE (%s), for more information check %s" % (" ".join(unpatched_cves),cve_file))
|
||||
|
||||
if write_string:
|
||||
@@ -403,3 +493,108 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
|
||||
|
||||
with open(d.getVar("CVE_CHECK_TMP_FILE"), "a") as f:
|
||||
f.write("%s" % write_string)
|
||||
|
||||
def cve_check_write_json_output(d, output, direct_file, deploy_file, manifest_file):
|
||||
"""
|
||||
Write CVE information in the JSON format: to WORKDIR; and to
|
||||
CVE_CHECK_DIR, if CVE manifest if enabled, write fragment
|
||||
files that will be assembled at the end in cve_check_write_rootfs_manifest.
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
write_string = json.dumps(output, indent=2)
|
||||
with open(direct_file, "w") as f:
|
||||
bb.note("Writing file %s with CVE information" % direct_file)
|
||||
f.write(write_string)
|
||||
|
||||
if d.getVar("CVE_CHECK_COPY_FILES") == "1":
|
||||
bb.utils.mkdirhier(os.path.dirname(deploy_file))
|
||||
with open(deploy_file, "w") as f:
|
||||
f.write(write_string)
|
||||
|
||||
if d.getVar("CVE_CHECK_CREATE_MANIFEST") == "1":
|
||||
cvelogpath = d.getVar("CVE_CHECK_SUMMARY_DIR")
|
||||
index_path = d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")
|
||||
bb.utils.mkdirhier(cvelogpath)
|
||||
fragment_file = os.path.basename(deploy_file)
|
||||
fragment_path = os.path.join(cvelogpath, fragment_file)
|
||||
with open(fragment_path, "w") as f:
|
||||
f.write(write_string)
|
||||
with open(index_path, "a+") as f:
|
||||
f.write("%s\n" % fragment_path)
|
||||
|
||||
def cve_write_data_json(d, patched, unpatched, ignored, cve_data):
|
||||
"""
|
||||
Prepare CVE data for the JSON format, then write it.
|
||||
"""
|
||||
|
||||
output = {"version":"1", "package": []}
|
||||
nvd_link = "https://nvd.nist.gov/vuln/detail/"
|
||||
|
||||
fdir_name = d.getVar("FILE_DIRNAME")
|
||||
layer = fdir_name.split("/")[-3]
|
||||
|
||||
include_layers = d.getVar("CVE_CHECK_LAYER_INCLUDELIST").split()
|
||||
exclude_layers = d.getVar("CVE_CHECK_LAYER_EXCLUDELIST").split()
|
||||
|
||||
if exclude_layers and layer in exclude_layers:
|
||||
return
|
||||
|
||||
if include_layers and layer not in include_layers:
|
||||
return
|
||||
|
||||
unpatched_cves = []
|
||||
|
||||
package_version = "%s%s" % (d.getVar("EXTENDPE"), d.getVar("PV"))
|
||||
package_data = {
|
||||
"name" : d.getVar("PN"),
|
||||
"layer" : layer,
|
||||
"version" : package_version
|
||||
}
|
||||
cve_list = []
|
||||
|
||||
for cve in sorted(cve_data):
|
||||
is_patched = cve in patched
|
||||
status = "Unpatched"
|
||||
if is_patched and (d.getVar("CVE_CHECK_REPORT_PATCHED") != "1"):
|
||||
continue
|
||||
if cve in ignored:
|
||||
status = "Ignored"
|
||||
elif is_patched:
|
||||
status = "Patched"
|
||||
else:
|
||||
# default value of status is Unpatched
|
||||
unpatched_cves.append(cve)
|
||||
|
||||
issue_link = "%s%s" % (nvd_link, cve)
|
||||
|
||||
cve_item = {
|
||||
"id" : cve,
|
||||
"summary" : cve_data[cve]["summary"],
|
||||
"scorev2" : cve_data[cve]["scorev2"],
|
||||
"scorev3" : cve_data[cve]["scorev3"],
|
||||
"vector" : cve_data[cve]["vector"],
|
||||
"status" : status,
|
||||
"link": issue_link
|
||||
}
|
||||
cve_list.append(cve_item)
|
||||
|
||||
package_data["issue"] = cve_list
|
||||
output["package"].append(package_data)
|
||||
|
||||
direct_file = d.getVar("CVE_CHECK_LOG_JSON")
|
||||
deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE_JSON")
|
||||
manifest_file = d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON")
|
||||
|
||||
cve_check_write_json_output(d, output, direct_file, deploy_file, manifest_file)
|
||||
|
||||
def cve_write_data(d, patched, unpatched, ignored, cve_data):
|
||||
"""
|
||||
Write CVE data in each enabled format.
|
||||
"""
|
||||
|
||||
if d.getVar("CVE_CHECK_FORMAT_TEXT") == "1":
|
||||
cve_write_data_text(d, patched, unpatched, ignored, cve_data)
|
||||
if d.getVar("CVE_CHECK_FORMAT_JSON") == "1":
|
||||
cve_write_data_json(d, patched, unpatched, ignored, cve_data)
|
||||
|
||||
@@ -2,6 +2,8 @@ inherit terminal
|
||||
|
||||
DEVSHELL = "${SHELL}"
|
||||
|
||||
PATH:prepend:task-devshell = "${COREBASE}/scripts/git-intercept:"
|
||||
|
||||
python do_devshell () {
|
||||
if d.getVarFlag("do_devshell", "manualfakeroot"):
|
||||
d.prependVar("DEVSHELL", "pseudo ")
|
||||
|
||||
@@ -267,9 +267,10 @@ python write_image_manifest () {
|
||||
|
||||
if os.path.exists(manifest_name) and link_name:
|
||||
manifest_link = deploy_dir + "/" + link_name + ".manifest"
|
||||
if os.path.lexists(manifest_link):
|
||||
os.remove(manifest_link)
|
||||
os.symlink(os.path.basename(manifest_name), manifest_link)
|
||||
if manifest_link != manifest_name:
|
||||
if os.path.lexists(manifest_link):
|
||||
os.remove(manifest_link)
|
||||
os.symlink(os.path.basename(manifest_name), manifest_link)
|
||||
}
|
||||
|
||||
# Can be used to create /etc/timestamp during image construction to give a reasonably
|
||||
@@ -339,9 +340,10 @@ python write_image_test_data() {
|
||||
|
||||
if os.path.exists(testdata_name) and link_name:
|
||||
testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
|
||||
if os.path.lexists(testdata_link):
|
||||
os.remove(testdata_link)
|
||||
os.symlink(os.path.basename(testdata_name), testdata_link)
|
||||
if testdata_link != testdata_name:
|
||||
if os.path.lexists(testdata_link):
|
||||
os.remove(testdata_link)
|
||||
os.symlink(os.path.basename(testdata_name), testdata_link)
|
||||
}
|
||||
write_image_test_data[vardepsexclude] += "TOPDIR"
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#
|
||||
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.35"
|
||||
UNINATIVE_VERSION = "3.5"
|
||||
UNINATIVE_VERSION = "3.6"
|
||||
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "6de0771bd21e0fcb5e80388e5b561a8023b24083bcbf46e056a089982aff75d7"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "8c8745becbfa1c341bae839c7eab56ddf17ce36c303bcd73d3b2f2f788b631c2"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "e8047a5748e6f266165da141eb6d08b23674f30e477b0e5505b6403d50fbc4b2"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "d64831cf2792c8e470c2e42230660e1a8e5de56a579cdd59978791f663c2f3ed"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "2f0ee9b66b1bb2c85e2b592fb3c9c7f5d77399fa638d74961330cdb8de34ca3b"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "9bfc4c970495b3716b2f9e52c4df9f968c02463a9a95000f6657fbc3fde1f098"
|
||||
|
||||
@@ -63,3 +63,19 @@ def _cmpkey(release, patch_l, pre_l, pre_v):
|
||||
else:
|
||||
_pre = float(pre_v) if pre_v else float('-inf')
|
||||
return _release, _patch, _pre
|
||||
|
||||
def cve_check_merge_jsons(output, data):
|
||||
"""
|
||||
Merge the data in the "package" property to the main data file
|
||||
output
|
||||
"""
|
||||
if output["version"] != data["version"]:
|
||||
bb.error("Version mismatch when merging JSON outputs")
|
||||
return
|
||||
|
||||
for product in output["package"]:
|
||||
if product["name"] == data["package"][0]["name"]:
|
||||
bb.error("Error adding the same package twice")
|
||||
return
|
||||
|
||||
output["package"].append(data["package"][0])
|
||||
|
||||
@@ -17,7 +17,7 @@ class EpoxyTest(OESDKTestCase):
|
||||
"""
|
||||
def setUp(self):
|
||||
if not (self.tc.hasHostPackage("nativesdk-meson")):
|
||||
raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain Meson")
|
||||
raise unittest.SkipTest("EpoxyTest class: SDK doesn't contain Meson")
|
||||
|
||||
def test_epoxy(self):
|
||||
with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir:
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
from oe.cve_check import Version
|
||||
import json
|
||||
import os
|
||||
from oeqa.selftest.case import OESelftestTestCase
|
||||
from oeqa.utils.commands import bitbake, get_bb_vars
|
||||
|
||||
class CVECheck(OESelftestTestCase):
|
||||
|
||||
def test_version_compare(self):
|
||||
from oe.cve_check import Version
|
||||
|
||||
result = Version("100") > Version("99")
|
||||
self.assertTrue( result, msg="Failed to compare version '100' > '99'")
|
||||
result = Version("2.3.1") > Version("2.2.3")
|
||||
@@ -42,3 +46,74 @@ class CVECheck(OESelftestTestCase):
|
||||
self.assertTrue( result ,msg="Failed to compare version with suffix '1.0p2' > '1.0p1'")
|
||||
result = Version("1.0_patch2","patch") < Version("1.0_patch3","patch")
|
||||
self.assertTrue( result ,msg="Failed to compare version with suffix '1.0_patch2' < '1.0_patch3'")
|
||||
|
||||
|
||||
def test_recipe_report_json(self):
|
||||
config = """
|
||||
INHERIT += "cve-check"
|
||||
CVE_CHECK_FORMAT_JSON = "1"
|
||||
"""
|
||||
self.write_config(config)
|
||||
|
||||
vars = get_bb_vars(["CVE_CHECK_SUMMARY_DIR", "CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
summary_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], vars["CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
recipe_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], "m4-native_cve.json")
|
||||
|
||||
try:
|
||||
os.remove(summary_json)
|
||||
os.remove(recipe_json)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
bitbake("m4-native -c cve_check")
|
||||
|
||||
def check_m4_json(filename):
|
||||
with open(filename) as f:
|
||||
report = json.load(f)
|
||||
self.assertEqual(report["version"], "1")
|
||||
self.assertEqual(len(report["package"]), 1)
|
||||
package = report["package"][0]
|
||||
self.assertEqual(package["name"], "m4-native")
|
||||
found_cves = { issue["id"]: issue["status"] for issue in package["issue"]}
|
||||
self.assertIn("CVE-2008-1687", found_cves)
|
||||
self.assertEqual(found_cves["CVE-2008-1687"], "Patched")
|
||||
|
||||
self.assertExists(summary_json)
|
||||
check_m4_json(summary_json)
|
||||
self.assertExists(recipe_json)
|
||||
check_m4_json(recipe_json)
|
||||
|
||||
|
||||
def test_image_json(self):
|
||||
config = """
|
||||
INHERIT += "cve-check"
|
||||
CVE_CHECK_FORMAT_JSON = "1"
|
||||
"""
|
||||
self.write_config(config)
|
||||
|
||||
vars = get_bb_vars(["CVE_CHECK_DIR", "CVE_CHECK_SUMMARY_DIR", "CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
report_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], vars["CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
print(report_json)
|
||||
try:
|
||||
os.remove(report_json)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
bitbake("core-image-minimal-initramfs")
|
||||
self.assertExists(report_json)
|
||||
|
||||
# Check that the summary report lists at least one package
|
||||
with open(report_json) as f:
|
||||
report = json.load(f)
|
||||
self.assertEqual(report["version"], "1")
|
||||
self.assertGreater(len(report["package"]), 1)
|
||||
|
||||
# Check that a random recipe wrote a recipe report to deploy/cve/
|
||||
recipename = report["package"][0]["name"]
|
||||
recipe_report = os.path.join(vars["CVE_CHECK_DIR"], recipename + "_cve.json")
|
||||
self.assertExists(recipe_report)
|
||||
with open(recipe_report) as f:
|
||||
report = json.load(f)
|
||||
self.assertEqual(report["version"], "1")
|
||||
self.assertEqual(len(report["package"]), 1)
|
||||
self.assertEqual(report["package"][0]["name"], recipename)
|
||||
|
||||
@@ -175,6 +175,8 @@ class TestImage(OESelftestTestCase):
|
||||
if "DISPLAY" not in os.environ:
|
||||
self.skipTest("virgl gtk test must be run inside a X session")
|
||||
distro = oe.lsb.distro_identifier()
|
||||
if distro and distro == 'almalinux-8.6':
|
||||
self.skipTest('virgl isn\'t working with Alma 8')
|
||||
if distro and distro == 'debian-8':
|
||||
self.skipTest('virgl isn\'t working with Debian 8')
|
||||
if distro and distro == 'centos-7':
|
||||
|
||||
@@ -5,8 +5,8 @@ SECTION = "network"
|
||||
LICENSE = "PD"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=87964579b2a8ece4bc6744d2dc9a8b04"
|
||||
|
||||
SRCREV = "4cbb44a9fe26aa6f0b28beb79f9488b37c097b5e"
|
||||
PV = "20220315"
|
||||
SRCREV = "3d5c8d0f7e0264768a2c000d0fd4b4d4a991e041"
|
||||
PV = "20220511"
|
||||
PE = "1"
|
||||
|
||||
SRC_URI = "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https;branch=main"
|
||||
|
||||
@@ -2,21 +2,22 @@ SUMMARY = "Linux NFC daemon"
|
||||
DESCRIPTION = "A daemon for the Linux Near Field Communication stack"
|
||||
HOMEPAGE = "http://01.org/linux-nfc"
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
|
||||
file://src/near.h;beginline=1;endline=20;md5=358e4deefef251a4761e1ffacc965d13 \
|
||||
"
|
||||
|
||||
DEPENDS = "dbus glib-2.0 libnl"
|
||||
|
||||
SRC_URI = "${KERNELORG_MIRROR}/linux/network/nfc/${BP}.tar.xz \
|
||||
SRC_URI = "git://git.kernel.org/pub/scm/network/nfc/neard.git;protocol=git;branch=master \
|
||||
file://neard.in \
|
||||
file://Makefile.am-fix-parallel-issue.patch \
|
||||
file://Makefile.am-do-not-ship-version.h.patch \
|
||||
file://0001-Add-header-dependency-to-nciattach.o.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "5c691fb7872856dc0d909c298bc8cb41"
|
||||
SRC_URI[sha256sum] = "eae3b11c541a988ec11ca94b7deab01080cd5b58cfef3ced6ceac9b6e6e65b36"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
|
||||
file://src/near.h;beginline=1;endline=20;md5=358e4deefef251a4761e1ffacc965d13 \
|
||||
"
|
||||
SRCREV = "949795024f7625420e93e288c56e194cb9a3e74a"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit autotools pkgconfig systemd update-rc.d
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From 770aea88c3888cc5cb3ebc94ffcef706c68bc1d2 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Mraz <tomas@openssl.org>
|
||||
Date: Wed, 1 Jun 2022 12:06:33 +0200
|
||||
Subject: [PATCH] Update expired SCT issuer certificate
|
||||
|
||||
Fixes #15179
|
||||
|
||||
Reviewed-by: Matt Caswell <matt@openssl.org>
|
||||
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
|
||||
(Merged from https://github.com/openssl/openssl/pull/18444)
|
||||
|
||||
Upstream-Status: Backport
|
||||
[Fixes ptest failures in OE-Core]
|
||||
---
|
||||
test/certs/embeddedSCTs1_issuer.pem | 30 ++++++++++++++---------------
|
||||
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/test/certs/embeddedSCTs1_issuer.pem b/test/certs/embeddedSCTs1_issuer.pem
|
||||
index 1fa449d5a098..6aa9455f09ed 100644
|
||||
--- a/test/certs/embeddedSCTs1_issuer.pem
|
||||
+++ b/test/certs/embeddedSCTs1_issuer.pem
|
||||
@@ -1,18 +1,18 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
-MIIC0DCCAjmgAwIBAgIBADANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJHQjEk
|
||||
+MIIC0jCCAjugAwIBAgIBADANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJHQjEk
|
||||
MCIGA1UEChMbQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5IENBMQ4wDAYDVQQIEwVX
|
||||
-YWxlczEQMA4GA1UEBxMHRXJ3IFdlbjAeFw0xMjA2MDEwMDAwMDBaFw0yMjA2MDEw
|
||||
-MDAwMDBaMFUxCzAJBgNVBAYTAkdCMSQwIgYDVQQKExtDZXJ0aWZpY2F0ZSBUcmFu
|
||||
-c3BhcmVuY3kgQ0ExDjAMBgNVBAgTBVdhbGVzMRAwDgYDVQQHEwdFcncgV2VuMIGf
|
||||
-MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVimhTYhCicRmTbneDIRgcKkATxtB7
|
||||
-jHbrkVfT0PtLO1FuzsvRyY2RxS90P6tjXVUJnNE6uvMa5UFEJFGnTHgW8iQ8+EjP
|
||||
-KDHM5nugSlojgZ88ujfmJNnDvbKZuDnd/iYx0ss6hPx7srXFL8/BT/9Ab1zURmnL
|
||||
-svfP34b7arnRsQIDAQABo4GvMIGsMB0GA1UdDgQWBBRfnYgNyHPmVNT4DdjmsMEk
|
||||
-tEfDVTB9BgNVHSMEdjB0gBRfnYgNyHPmVNT4DdjmsMEktEfDVaFZpFcwVTELMAkG
|
||||
-A1UEBhMCR0IxJDAiBgNVBAoTG0NlcnRpZmljYXRlIFRyYW5zcGFyZW5jeSBDQTEO
|
||||
-MAwGA1UECBMFV2FsZXMxEDAOBgNVBAcTB0VydyBXZW6CAQAwDAYDVR0TBAUwAwEB
|
||||
-/zANBgkqhkiG9w0BAQUFAAOBgQAGCMxKbWTyIF4UbASydvkrDvqUpdryOvw4BmBt
|
||||
-OZDQoeojPUApV2lGOwRmYef6HReZFSCa6i4Kd1F2QRIn18ADB8dHDmFYT9czQiRy
|
||||
-f1HWkLxHqd81TbD26yWVXeGJPE3VICskovPkQNJ0tU4b03YmnKliibduyqQQkOFP
|
||||
-OwqULg==
|
||||
+YWxlczEQMA4GA1UEBxMHRXJ3IFdlbjAgFw0yMjA2MDExMDM4MDJaGA8yMTIyMDUw
|
||||
+ODEwMzgwMlowVTELMAkGA1UEBhMCR0IxJDAiBgNVBAoTG0NlcnRpZmljYXRlIFRy
|
||||
+YW5zcGFyZW5jeSBDQTEOMAwGA1UECBMFV2FsZXMxEDAOBgNVBAcTB0VydyBXZW4w
|
||||
+gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANWKaFNiEKJxGZNud4MhGBwqQBPG
|
||||
+0HuMduuRV9PQ+0s7UW7Oy9HJjZHFL3Q/q2NdVQmc0Tq68xrlQUQkUadMeBbyJDz4
|
||||
+SM8oMczme6BKWiOBnzy6N+Yk2cO9spm4Od3+JjHSyzqE/HuytcUvz8FP/0BvXNRG
|
||||
+acuy98/fhvtqudGxAgMBAAGjga8wgawwHQYDVR0OBBYEFF+diA3Ic+ZU1PgN2Oaw
|
||||
+wSS0R8NVMH0GA1UdIwR2MHSAFF+diA3Ic+ZU1PgN2OawwSS0R8NVoVmkVzBVMQsw
|
||||
+CQYDVQQGEwJHQjEkMCIGA1UEChMbQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5IENB
|
||||
+MQ4wDAYDVQQIEwVXYWxlczEQMA4GA1UEBxMHRXJ3IFdlboIBADAMBgNVHRMEBTAD
|
||||
+AQH/MA0GCSqGSIb3DQEBCwUAA4GBAD0aYh9OkFYfXV7kBfhrtD0PJG2U47OV/1qq
|
||||
++uFpqB0S1WO06eJT0pzYf1ebUcxjBkajbJZm/FHT85VthZ1lFHsky87aFD8XlJCo
|
||||
+2IOhKOkvvWKPUdFLoO/ZVXqEVKkcsS1eXK1glFvb07eJZya3JVG0KdMhV2YoDg6c
|
||||
+Doud4XrO
|
||||
-----END CERTIFICATE-----
|
||||
@@ -18,13 +18,14 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
|
||||
file://afalg.patch \
|
||||
file://reproducible.patch \
|
||||
file://reproducibility.patch \
|
||||
file://770aea88c3888cc5cb3ebc94ffcef706c68bc1d2.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-nativesdk = " \
|
||||
file://environment.d-openssl.sh \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a"
|
||||
SRC_URI[sha256sum] = "9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f"
|
||||
|
||||
inherit lib_package multilib_header multilib_script ptest
|
||||
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
|
||||
@@ -348,7 +348,7 @@ do_install_ptest () {
|
||||
# These access the internet which is not guaranteed to work on machines running the tests
|
||||
rm -rf ${D}${PTEST_PATH}/testsuite/wget
|
||||
sort ${B}/.config > ${D}${PTEST_PATH}/.config
|
||||
ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
|
||||
ln -s ${base_bindir}/busybox ${D}${PTEST_PATH}/busybox
|
||||
}
|
||||
|
||||
inherit update-alternatives
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From c7e181fdf58c392e06ab805e2c044c3e57d5445a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Sun, 3 Apr 2022 12:14:33 +0000
|
||||
Subject: [PATCH] libbb: sockaddr2str: ensure only printable characters are
|
||||
returned for the hostname part
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Signed-off-by: Steve Sakoman <steve@sakoman.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index eb2871cb1..b5520bb21 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -501,8 +501,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -513,7 +514,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From f8ad7c331b25ba90fd296b37c443b4114cb196e2 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Sun, 3 Apr 2022 12:16:45 +0000
|
||||
Subject: [PATCH] nslookup: sanitize all printed strings with printable_string
|
||||
|
||||
Otherwise, terminal sequences can be injected, which enables various terminal injection
|
||||
attacks from DNS results.
|
||||
|
||||
MJ: One chunk wasn't applicable on 1.31.1 version, because parsing of
|
||||
SRV records was added only in newer 1.32.0 with:
|
||||
commit 6b4960155e94076bf25518e4e268a7a5f849308e
|
||||
Author: Jo-Philipp Wich <jo@mein.io>
|
||||
Date: Thu Jun 27 17:27:29 2019 +0200
|
||||
|
||||
nslookup: implement support for SRV records
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Signed-off-by: Steve Sakoman <steve@sakoman.com>
|
||||
---
|
||||
networking/nslookup.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index 24e09d4f0..89b9c8a13 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -404,7 +404,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -419,7 +419,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -431,7 +431,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -461,7 +461,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
@@ -55,6 +55,8 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
|
||||
file://CVE-2021-42374.patch \
|
||||
file://CVE-2021-42376.patch \
|
||||
file://CVE-2021-423xx-awk.patch \
|
||||
file://0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch \
|
||||
file://0002-nslookup-sanitize-all-printed-strings-with-printable.patch \
|
||||
"
|
||||
SRC_URI_append_libc-musl = " file://musl.cfg "
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From b07251215ef48c70c6e56f7351406c47cfca4d5b Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Fri, 10 Jan 2020 15:55:07 +0100
|
||||
Subject: [PATCH] Fix integer overflow in xmlBufferResize
|
||||
|
||||
Found by OSS-Fuzz.
|
||||
|
||||
CVE: CVE-2022-29824
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/b07251215ef48c70c6e56f7351406c47cfca4d5b]
|
||||
|
||||
Signed-off-by: Riyaz Ahmed Khan <Riyaz.Khan@kpit.com>
|
||||
|
||||
---
|
||||
tree.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tree.c b/tree.c
|
||||
index 0d7fc98c..f43f6de1 100644
|
||||
--- a/tree.c
|
||||
+++ b/tree.c
|
||||
@@ -7424,12 +7424,17 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
if (size < buf->size)
|
||||
return 1;
|
||||
|
||||
+ if (size > UINT_MAX - 10) {
|
||||
+ xmlTreeErrMemory("growing buffer");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
/* figure out new size */
|
||||
switch (buf->alloc){
|
||||
case XML_BUFFER_ALLOC_IO:
|
||||
case XML_BUFFER_ALLOC_DOUBLEIT:
|
||||
/*take care of empty case*/
|
||||
- newSize = (buf->size ? buf->size*2 : size + 10);
|
||||
+ newSize = (buf->size ? buf->size : size + 10);
|
||||
while (size > newSize) {
|
||||
if (newSize > UINT_MAX / 2) {
|
||||
xmlTreeErrMemory("growing buffer");
|
||||
@@ -7445,7 +7450,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
if (buf->use < BASE_BUFFER_SIZE)
|
||||
newSize = size;
|
||||
else {
|
||||
- newSize = buf->size * 2;
|
||||
+ newSize = buf->size;
|
||||
while (size > newSize) {
|
||||
if (newSize > UINT_MAX / 2) {
|
||||
xmlTreeErrMemory("growing buffer");
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
348
meta/recipes-core/libxml/libxml2/CVE-2022-29824.patch
Normal file
348
meta/recipes-core/libxml/libxml2/CVE-2022-29824.patch
Normal file
@@ -0,0 +1,348 @@
|
||||
From 2554a2408e09f13652049e5ffb0d26196b02ebab Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Tue, 8 Mar 2022 20:10:02 +0100
|
||||
Subject: [PATCH] [CVE-2022-29824] Fix integer overflows in xmlBuf and
|
||||
xmlBuffer
|
||||
|
||||
In several places, the code handling string buffers didn't check for
|
||||
integer overflow or used wrong types for buffer sizes. This could
|
||||
result in out-of-bounds writes or other memory errors when working on
|
||||
large, multi-gigabyte buffers.
|
||||
|
||||
Thanks to Felix Wilhelm for the report.
|
||||
|
||||
CVE: CVE-2022-29824
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/2554a2408e09f13652049e5ffb0d26196b02ebab]
|
||||
|
||||
Signed-off-by: Riyaz Ahmed Khan <Riyaz.Khan@kpit.com>
|
||||
|
||||
---
|
||||
buf.c | 86 +++++++++++++++++++++++-----------------------------------
|
||||
tree.c | 72 ++++++++++++++++++------------------------------
|
||||
2 files changed, 61 insertions(+), 97 deletions(-)
|
||||
|
||||
diff --git a/buf.c b/buf.c
|
||||
index 24368d37..40a5ee06 100644
|
||||
--- a/buf.c
|
||||
+++ b/buf.c
|
||||
@@ -30,6 +30,10 @@
|
||||
#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
|
||||
#include "buf.h"
|
||||
|
||||
+#ifndef SIZE_MAX
|
||||
+#define SIZE_MAX ((size_t) -1)
|
||||
+#endif
|
||||
+
|
||||
#define WITH_BUFFER_COMPAT
|
||||
|
||||
/**
|
||||
@@ -156,6 +160,8 @@ xmlBufPtr
|
||||
xmlBufCreateSize(size_t size) {
|
||||
xmlBufPtr ret;
|
||||
|
||||
+ if (size == SIZE_MAX)
|
||||
+ return(NULL);
|
||||
ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));
|
||||
if (ret == NULL) {
|
||||
xmlBufMemoryError(NULL, "creating buffer");
|
||||
@@ -166,8 +172,8 @@ xmlBufCreateSize(size_t size) {
|
||||
ret->error = 0;
|
||||
ret->buffer = NULL;
|
||||
ret->alloc = xmlBufferAllocScheme;
|
||||
- ret->size = (size ? size+2 : 0); /* +1 for ending null */
|
||||
- ret->compat_size = (int) ret->size;
|
||||
+ ret->size = (size ? size + 1 : 0); /* +1 for ending null */
|
||||
+ ret->compat_size = (ret->size > INT_MAX ? INT_MAX : ret->size);
|
||||
if (ret->size){
|
||||
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
|
||||
if (ret->content == NULL) {
|
||||
@@ -442,23 +448,17 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
|
||||
CHECK_COMPAT(buf)
|
||||
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
|
||||
- if (buf->use + len < buf->size)
|
||||
+ if (len < buf->size - buf->use)
|
||||
return(buf->size - buf->use);
|
||||
+ if (len > SIZE_MAX - buf->use)
|
||||
+ return(0);
|
||||
|
||||
- /*
|
||||
- * Windows has a BIG problem on realloc timing, so we try to double
|
||||
- * the buffer size (if that's enough) (bug 146697)
|
||||
- * Apparently BSD too, and it's probably best for linux too
|
||||
- * On an embedded system this may be something to change
|
||||
- */
|
||||
-#if 1
|
||||
- if (buf->size > (size_t) len)
|
||||
- size = buf->size * 2;
|
||||
- else
|
||||
- size = buf->use + len + 100;
|
||||
-#else
|
||||
- size = buf->use + len + 100;
|
||||
-#endif
|
||||
+ if (buf->size > (size_t) len) {
|
||||
+ size = buf->size > SIZE_MAX / 2 ? SIZE_MAX : buf->size * 2;
|
||||
+ } else {
|
||||
+ size = buf->use + len;
|
||||
+ size = size > SIZE_MAX - 100 ? SIZE_MAX : size + 100;
|
||||
+ }
|
||||
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
|
||||
/*
|
||||
@@ -744,7 +744,7 @@ xmlBufIsEmpty(const xmlBufPtr buf)
|
||||
int
|
||||
xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
{
|
||||
- unsigned int newSize;
|
||||
+ size_t newSize;
|
||||
xmlChar* rebuf = NULL;
|
||||
size_t start_buf;
|
||||
|
||||
@@ -772,9 +772,13 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
case XML_BUFFER_ALLOC_IO:
|
||||
case XML_BUFFER_ALLOC_DOUBLEIT:
|
||||
/*take care of empty case*/
|
||||
- newSize = (buf->size ? buf->size*2 : size + 10);
|
||||
+ if (buf->size == 0) {
|
||||
+ newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10);
|
||||
+ } else {
|
||||
+ newSize = buf->size;
|
||||
+ }
|
||||
while (size > newSize) {
|
||||
- if (newSize > UINT_MAX / 2) {
|
||||
+ if (newSize > SIZE_MAX / 2) {
|
||||
xmlBufMemoryError(buf, "growing buffer");
|
||||
return 0;
|
||||
}
|
||||
@@ -782,15 +786,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
}
|
||||
break;
|
||||
case XML_BUFFER_ALLOC_EXACT:
|
||||
- newSize = size+10;
|
||||
+ newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10);
|
||||
break;
|
||||
case XML_BUFFER_ALLOC_HYBRID:
|
||||
if (buf->use < BASE_BUFFER_SIZE)
|
||||
newSize = size;
|
||||
else {
|
||||
- newSize = buf->size * 2;
|
||||
+ newSize = buf->size;
|
||||
while (size > newSize) {
|
||||
- if (newSize > UINT_MAX / 2) {
|
||||
+ if (newSize > SIZE_MAX / 2) {
|
||||
xmlBufMemoryError(buf, "growing buffer");
|
||||
return 0;
|
||||
}
|
||||
@@ -800,7 +804,7 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
break;
|
||||
|
||||
default:
|
||||
- newSize = size+10;
|
||||
+ newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -866,7 +870,7 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
*/
|
||||
int
|
||||
xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
|
||||
- unsigned int needSize;
|
||||
+ size_t needSize;
|
||||
|
||||
if ((str == NULL) || (buf == NULL) || (buf->error))
|
||||
return -1;
|
||||
@@ -888,8 +892,10 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
|
||||
if (len < 0) return -1;
|
||||
if (len == 0) return 0;
|
||||
|
||||
- needSize = buf->use + len + 2;
|
||||
- if (needSize > buf->size){
|
||||
+ if ((size_t) len >= buf->size - buf->use) {
|
||||
+ if ((size_t) len >= SIZE_MAX - buf->use)
|
||||
+ return(-1);
|
||||
+ needSize = buf->use + len + 1;
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
|
||||
/*
|
||||
* Used to provide parsing limits
|
||||
@@ -1025,31 +1031,7 @@ xmlBufCat(xmlBufPtr buf, const xmlChar *str) {
|
||||
*/
|
||||
int
|
||||
xmlBufCCat(xmlBufPtr buf, const char *str) {
|
||||
- const char *cur;
|
||||
-
|
||||
- if ((buf == NULL) || (buf->error))
|
||||
- return(-1);
|
||||
- CHECK_COMPAT(buf)
|
||||
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
|
||||
- if (str == NULL) {
|
||||
-#ifdef DEBUG_BUFFER
|
||||
- xmlGenericError(xmlGenericErrorContext,
|
||||
- "xmlBufCCat: str == NULL\n");
|
||||
-#endif
|
||||
- return -1;
|
||||
- }
|
||||
- for (cur = str;*cur != 0;cur++) {
|
||||
- if (buf->use + 10 >= buf->size) {
|
||||
- if (!xmlBufResize(buf, buf->use+10)){
|
||||
- xmlBufMemoryError(buf, "growing buffer");
|
||||
- return XML_ERR_NO_MEMORY;
|
||||
- }
|
||||
- }
|
||||
- buf->content[buf->use++] = *cur;
|
||||
- }
|
||||
- buf->content[buf->use] = 0;
|
||||
- UPDATE_COMPAT(buf)
|
||||
- return 0;
|
||||
+ return xmlBufCat(buf, (const xmlChar *) str);
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/tree.c b/tree.c
|
||||
index 9d94aa42..86afb7d6 100644
|
||||
--- a/tree.c
|
||||
+++ b/tree.c
|
||||
@@ -7104,6 +7104,8 @@ xmlBufferPtr
|
||||
xmlBufferCreateSize(size_t size) {
|
||||
xmlBufferPtr ret;
|
||||
|
||||
+ if (size >= UINT_MAX)
|
||||
+ return(NULL);
|
||||
ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
|
||||
if (ret == NULL) {
|
||||
xmlTreeErrMemory("creating buffer");
|
||||
@@ -7111,7 +7113,7 @@ xmlBufferCreateSize(size_t size) {
|
||||
}
|
||||
ret->use = 0;
|
||||
ret->alloc = xmlBufferAllocScheme;
|
||||
- ret->size = (size ? size+2 : 0); /* +1 for ending null */
|
||||
+ ret->size = (size ? size + 1 : 0); /* +1 for ending null */
|
||||
if (ret->size){
|
||||
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
|
||||
if (ret->content == NULL) {
|
||||
@@ -7171,6 +7173,8 @@ xmlBufferCreateStatic(void *mem, size_t size) {
|
||||
|
||||
if ((mem == NULL) || (size == 0))
|
||||
return(NULL);
|
||||
+ if (size > UINT_MAX)
|
||||
+ return(NULL);
|
||||
|
||||
ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
|
||||
if (ret == NULL) {
|
||||
@@ -7318,28 +7322,23 @@ xmlBufferShrink(xmlBufferPtr buf, unsigned int len) {
|
||||
*/
|
||||
int
|
||||
xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
|
||||
- int size;
|
||||
+ unsigned int size;
|
||||
xmlChar *newbuf;
|
||||
|
||||
if (buf == NULL) return(-1);
|
||||
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
|
||||
- if (len + buf->use < buf->size) return(0);
|
||||
+ if (len < buf->size - buf->use)
|
||||
+ return(0);
|
||||
+ if (len > UINT_MAX - buf->use)
|
||||
+ return(-1);
|
||||
|
||||
- /*
|
||||
- * Windows has a BIG problem on realloc timing, so we try to double
|
||||
- * the buffer size (if that's enough) (bug 146697)
|
||||
- * Apparently BSD too, and it's probably best for linux too
|
||||
- * On an embedded system this may be something to change
|
||||
- */
|
||||
-#if 1
|
||||
- if (buf->size > len)
|
||||
- size = buf->size * 2;
|
||||
- else
|
||||
- size = buf->use + len + 100;
|
||||
-#else
|
||||
- size = buf->use + len + 100;
|
||||
-#endif
|
||||
+ if (buf->size > (size_t) len) {
|
||||
+ size = buf->size > UINT_MAX / 2 ? UINT_MAX : buf->size * 2;
|
||||
+ } else {
|
||||
+ size = buf->use + len;
|
||||
+ size = size > UINT_MAX - 100 ? UINT_MAX : size + 100;
|
||||
+ }
|
||||
|
||||
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
|
||||
size_t start_buf = buf->content - buf->contentIO;
|
||||
@@ -7466,7 +7465,10 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
case XML_BUFFER_ALLOC_IO:
|
||||
case XML_BUFFER_ALLOC_DOUBLEIT:
|
||||
/*take care of empty case*/
|
||||
- newSize = (buf->size ? buf->size : size + 10);
|
||||
+ if (buf->size == 0)
|
||||
+ newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);
|
||||
+ else
|
||||
+ newSize = buf->size;
|
||||
while (size > newSize) {
|
||||
if (newSize > UINT_MAX / 2) {
|
||||
xmlTreeErrMemory("growing buffer");
|
||||
@@ -7476,7 +7478,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
}
|
||||
break;
|
||||
case XML_BUFFER_ALLOC_EXACT:
|
||||
- newSize = size+10;
|
||||
+ newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);;
|
||||
break;
|
||||
case XML_BUFFER_ALLOC_HYBRID:
|
||||
if (buf->use < BASE_BUFFER_SIZE)
|
||||
@@ -7494,7 +7496,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
break;
|
||||
|
||||
default:
|
||||
- newSize = size+10;
|
||||
+ newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7580,8 +7582,10 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
|
||||
if (len < 0) return -1;
|
||||
if (len == 0) return 0;
|
||||
|
||||
- needSize = buf->use + len + 2;
|
||||
- if (needSize > buf->size){
|
||||
+ if ((unsigned) len >= buf->size - buf->use) {
|
||||
+ if ((unsigned) len >= UINT_MAX - buf->use)
|
||||
+ return XML_ERR_NO_MEMORY;
|
||||
+ needSize = buf->use + len + 1;
|
||||
if (!xmlBufferResize(buf, needSize)){
|
||||
xmlTreeErrMemory("growing buffer");
|
||||
return XML_ERR_NO_MEMORY;
|
||||
@@ -7694,29 +7698,7 @@ xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) {
|
||||
*/
|
||||
int
|
||||
xmlBufferCCat(xmlBufferPtr buf, const char *str) {
|
||||
- const char *cur;
|
||||
-
|
||||
- if (buf == NULL)
|
||||
- return(-1);
|
||||
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
|
||||
- if (str == NULL) {
|
||||
-#ifdef DEBUG_BUFFER
|
||||
- xmlGenericError(xmlGenericErrorContext,
|
||||
- "xmlBufferCCat: str == NULL\n");
|
||||
-#endif
|
||||
- return -1;
|
||||
- }
|
||||
- for (cur = str;*cur != 0;cur++) {
|
||||
- if (buf->use + 10 >= buf->size) {
|
||||
- if (!xmlBufferResize(buf, buf->use+10)){
|
||||
- xmlTreeErrMemory("growing buffer");
|
||||
- return XML_ERR_NO_MEMORY;
|
||||
- }
|
||||
- }
|
||||
- buf->content[buf->use++] = *cur;
|
||||
- }
|
||||
- buf->content[buf->use] = 0;
|
||||
- return 0;
|
||||
+ return xmlBufferCat(buf, (const xmlChar *) str);
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -30,6 +30,8 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=te
|
||||
file://CVE-2021-3541.patch \
|
||||
file://CVE-2022-23308.patch \
|
||||
file://CVE-2022-23308-fix-regression.patch \
|
||||
file://CVE-2022-29824-dependent.patch \
|
||||
file://CVE-2022-29824.patch \
|
||||
"
|
||||
|
||||
SRC_URI[archive.sha256sum] = "593b7b751dd18c2d6abcd0c4bcb29efc203d0b4373a6df98e3a455ea74ae2813"
|
||||
|
||||
@@ -12,6 +12,10 @@ deltask do_compile
|
||||
deltask do_install
|
||||
deltask do_populate_sysroot
|
||||
|
||||
# CVE database update interval, in seconds. By default: once a day (24*60*60).
|
||||
# Use 0 to force the update
|
||||
CVE_DB_UPDATE_INTERVAL ?= "86400"
|
||||
|
||||
python () {
|
||||
if not bb.data.inherits_class("cve-check", d):
|
||||
raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.")
|
||||
@@ -42,11 +46,16 @@ python do_fetch() {
|
||||
if os.path.exists(db_file):
|
||||
os.remove(db_file)
|
||||
|
||||
# Don't refresh the database more than once an hour
|
||||
# The NVD database changes once a day, so no need to update more frequently
|
||||
# Allow the user to force-update
|
||||
try:
|
||||
import time
|
||||
if time.time() - os.path.getmtime(db_file) < (60*60):
|
||||
update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL"))
|
||||
if (update_interval < 0):
|
||||
update_interval = 0
|
||||
if time.time() - os.path.getmtime(db_file) < update_interval:
|
||||
return
|
||||
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
135
meta/recipes-core/ncurses/files/CVE-2022-29458.patch
Normal file
135
meta/recipes-core/ncurses/files/CVE-2022-29458.patch
Normal file
@@ -0,0 +1,135 @@
|
||||
From 5f40697e37e195069f55528fc7a1d77e619ad104 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Tran <dantran@microsoft.com>
|
||||
Date: Fri, 13 May 2022 13:28:41 -0700
|
||||
Subject: [PATCH] ncurses 6.3 before patch 20220416 has an out-of-bounds read
|
||||
and segmentation violation in convert_strings in tinfo/read_entry.c in the
|
||||
terminfo library.
|
||||
|
||||
CVE: CVE-2022-29458
|
||||
Upstream-Status: Backport
|
||||
[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009870]
|
||||
|
||||
Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
ncurses/tinfo/alloc_entry.c | 14 ++++++--------
|
||||
ncurses/tinfo/read_entry.c | 25 +++++++++++++++++++------
|
||||
2 files changed, 25 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c
|
||||
index 4bf7d6c8..b49ad6aa 100644
|
||||
--- a/ncurses/tinfo/alloc_entry.c
|
||||
+++ b/ncurses/tinfo/alloc_entry.c
|
||||
@@ -48,13 +48,11 @@
|
||||
|
||||
#include <tic.h>
|
||||
|
||||
-MODULE_ID("$Id: alloc_entry.c,v 1.64 2020/02/02 23:34:34 tom Exp $")
|
||||
+MODULE_ID("$Id: alloc_entry.c,v 1.69 2022/04/16 22:46:53 tom Exp $")
|
||||
|
||||
#define ABSENT_OFFSET -1
|
||||
#define CANCELLED_OFFSET -2
|
||||
|
||||
-#define MAX_STRTAB 4096 /* documented maximum entry size */
|
||||
-
|
||||
static char *stringbuf; /* buffer for string capabilities */
|
||||
static size_t next_free; /* next free character in stringbuf */
|
||||
|
||||
@@ -71,8 +69,8 @@ _nc_init_entry(ENTRY * const tp)
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (stringbuf == 0)
|
||||
- TYPE_MALLOC(char, (size_t) MAX_STRTAB, stringbuf);
|
||||
+ if (stringbuf == NULL)
|
||||
+ TYPE_MALLOC(char, (size_t) MAX_ENTRY_SIZE, stringbuf);
|
||||
|
||||
next_free = 0;
|
||||
|
||||
@@ -108,11 +106,11 @@ _nc_save_str(const char *const string)
|
||||
* Cheat a little by making an empty string point to the end of the
|
||||
* previous string.
|
||||
*/
|
||||
- if (next_free < MAX_STRTAB) {
|
||||
+ if (next_free < MAX_ENTRY_SIZE) {
|
||||
result = (stringbuf + next_free - 1);
|
||||
}
|
||||
- } else if (next_free + len < MAX_STRTAB) {
|
||||
- _nc_STRCPY(&stringbuf[next_free], string, MAX_STRTAB);
|
||||
+ } else if (next_free + len < MAX_ENTRY_SIZE) {
|
||||
+ _nc_STRCPY(&stringbuf[next_free], string, MAX_ENTRY_SIZE);
|
||||
DEBUG(7, ("Saved string %s", _nc_visbuf(string)));
|
||||
DEBUG(7, ("at location %d", (int) next_free));
|
||||
next_free += len;
|
||||
diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c
|
||||
index 5b570b0f..23c2cebc 100644
|
||||
--- a/ncurses/tinfo/read_entry.c
|
||||
+++ b/ncurses/tinfo/read_entry.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
- * Copyright 2018-2019,2020 Thomas E. Dickey *
|
||||
+ * Copyright 2018-2021,2022 Thomas E. Dickey *
|
||||
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#include <tic.h>
|
||||
|
||||
-MODULE_ID("$Id: read_entry.c,v 1.157 2020/02/02 23:34:34 tom Exp $")
|
||||
+MODULE_ID("$Id: read_entry.c,v 1.162 2022/04/16 21:00:00 tom Exp $")
|
||||
|
||||
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
|
||||
|
||||
@@ -145,6 +145,7 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
+ bool corrupt = FALSE;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (IS_NEG1(buf + 2 * i)) {
|
||||
@@ -154,8 +155,20 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table)
|
||||
} else if (MyNumber(buf + 2 * i) > size) {
|
||||
Strings[i] = ABSENT_STRING;
|
||||
} else {
|
||||
- Strings[i] = (MyNumber(buf + 2 * i) + table);
|
||||
- TR(TRACE_DATABASE, ("Strings[%d] = %s", i, _nc_visbuf(Strings[i])));
|
||||
+ int nn = MyNumber(buf + 2 * i);
|
||||
+ if (nn >= 0 && nn < size) {
|
||||
+ Strings[i] = (nn + table);
|
||||
+ TR(TRACE_DATABASE, ("Strings[%d] = %s", i,
|
||||
+ _nc_visbuf(Strings[i])));
|
||||
+ } else {
|
||||
+ if (!corrupt) {
|
||||
+ corrupt = TRUE;
|
||||
+ TR(TRACE_DATABASE,
|
||||
+ ("ignore out-of-range index %d to Strings[]", nn));
|
||||
+ _nc_warning("corrupt data found in convert_strings");
|
||||
+ }
|
||||
+ Strings[i] = ABSENT_STRING;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* make sure all strings are NUL terminated */
|
||||
@@ -776,7 +789,7 @@ _nc_read_tic_entry(char *filename,
|
||||
* looking for compiled (binary) terminfo data.
|
||||
*
|
||||
* cgetent uses a two-level lookup. On the first it uses the given
|
||||
- * name to return a record containing only the aliases for an entry.
|
||||
+ * name to return a record containing only the aliases for an entry.
|
||||
* On the second (using that list of aliases as a key), it returns the
|
||||
* content of the terminal description. We expect second lookup to
|
||||
* return data beginning with the same set of aliases.
|
||||
@@ -833,7 +846,7 @@ _nc_read_tic_entry(char *filename,
|
||||
#endif /* NCURSES_USE_DATABASE */
|
||||
|
||||
/*
|
||||
- * Find and read the compiled entry for a given terminal type, if it exists.
|
||||
+ * Find and read the compiled entry for a given terminal type, if it exists.
|
||||
* We take pains here to make sure no combination of environment variables and
|
||||
* terminal type name can be used to overrun the file buffer.
|
||||
*/
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -4,6 +4,7 @@ SRC_URI += "file://0001-tic-hang.patch \
|
||||
file://0002-configure-reproducible.patch \
|
||||
file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \
|
||||
file://CVE-2021-39537.patch \
|
||||
file://CVE-2022-29458.patch \
|
||||
"
|
||||
# commit id corresponds to the revision in package version
|
||||
SRCREV = "a669013cd5e9d6434e5301348ea51baf306c93c4"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=Bind mount volatile @where@
|
||||
DefaultDependencies=false
|
||||
DefaultDependencies=no
|
||||
Before=local-fs.target
|
||||
RequiresMountsFor=@whatparent@ @whereparent@
|
||||
ConditionPathIsReadWrite=@whatparent@
|
||||
|
||||
@@ -22,7 +22,7 @@ CVE_PRODUCT = "git-scm:git"
|
||||
# This is about a manpage not mentioning --mirror may "leak" information
|
||||
# in mirrored git repos. Most OE users wouldn't build the docs and
|
||||
# we don't see this as a major issue for our general users/usecases.
|
||||
CVE_CHECK_IGNORE += "CVE-2022-24975"
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-24975"
|
||||
|
||||
PACKAGECONFIG ??= ""
|
||||
PACKAGECONFIG[cvsserver] = ""
|
||||
|
||||
@@ -57,6 +57,9 @@ CVE_CHECK_WHITELIST += "CVE-2019-18348"
|
||||
|
||||
# This is windows only issue.
|
||||
CVE_CHECK_WHITELIST += "CVE-2020-15523 CVE-2022-26488"
|
||||
# The mailcap module is insecure by design, so this can't be fixed in a meaningful way.
|
||||
# The module will be removed in the future and flaws documented.
|
||||
CVE_CHECK_WHITELIST += "CVE-2015-20107"
|
||||
|
||||
PYTHON_MAJMIN = "3.8"
|
||||
|
||||
|
||||
@@ -9,8 +9,12 @@ SRC_URI += " \
|
||||
file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "ede247b56fb862f1f67f9471189b04d4"
|
||||
SRC_URI[sha256sum] = "2755b900a21235b443bb16dadd9032f784d4a88f143d852bc5d154f22b8781f1"
|
||||
SRC_URI[md5sum] = "f972fb0cce662966bec10d5c5f32d042"
|
||||
SRC_URI[sha256sum] = "e7203b0cc09442ed2c08936d483f8ac140ec1c72e37bb5c401646b7866cb5d10"
|
||||
|
||||
# CVE-2021-28966 is Windows specific and not affects Linux OS
|
||||
# https://security-tracker.debian.org/tracker/CVE-2021-28966
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-28966"
|
||||
|
||||
PACKAGECONFIG ??= ""
|
||||
PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
|
||||
33
meta/recipes-graphics/freetype/freetype/CVE-2022-27404.patch
Normal file
33
meta/recipes-graphics/freetype/freetype/CVE-2022-27404.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 53dfdcd8198d2b3201a23c4bad9190519ba918db Mon Sep 17 00:00:00 2001
|
||||
From: Werner Lemberg <wl@gnu.org>
|
||||
Date: Thu, 17 Mar 2022 19:24:16 +0100
|
||||
Subject: [PATCH] [sfnt] Avoid invalid face index.
|
||||
|
||||
Fixes #1138.
|
||||
|
||||
* src/sfnt/sfobjs.c (sfnt_init_face), src/sfnt/sfwoff2.c (woff2_open_font):
|
||||
Check `face_index` before decrementing.
|
||||
|
||||
CVE: CVE-2022-27404
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/freetype/freetype/-/commit/53dfdcd8198d2b3201a23c4bad9190519ba918db.patch]
|
||||
Comment: Removed second hunk as sfwoff2.c file is not part of current v2.10.1 code
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
---
|
||||
src/sfnt/sfobjs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
|
||||
index f9d4d3858..9771c35df 100644
|
||||
--- a/src/sfnt/sfobjs.c
|
||||
+++ b/src/sfnt/sfobjs.c
|
||||
@@ -566,7 +566,7 @@
|
||||
face_index = FT_ABS( face_instance_index ) & 0xFFFF;
|
||||
|
||||
/* value -(N+1) requests information on index N */
|
||||
- if ( face_instance_index < 0 )
|
||||
+ if ( face_instance_index < 0 && face_index > 0 )
|
||||
face_index--;
|
||||
|
||||
if ( face_index >= face->ttc_header.count )
|
||||
--
|
||||
GitLab
|
||||
38
meta/recipes-graphics/freetype/freetype/CVE-2022-27405.patch
Normal file
38
meta/recipes-graphics/freetype/freetype/CVE-2022-27405.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 22a0cccb4d9d002f33c1ba7a4b36812c7d4f46b5 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Lemberg <wl@gnu.org>
|
||||
Date: Sat, 19 Mar 2022 06:40:17 +0100
|
||||
Subject: [PATCH] * src/base/ftobjs.c (ft_open_face_internal): Properly guard
|
||||
`face_index`.
|
||||
We must ensure that the cast to `FT_Int` doesn't change the sign.
|
||||
Fixes #1139.
|
||||
|
||||
CVE: CVE-2022-27405
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/freetype/freetype/-/commit/22a0cccb4d9d002f33c1ba7a4b36812c7d4f46b5]
|
||||
Comment: No Change in any hunk
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
---
|
||||
src/base/ftobjs.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
|
||||
index 2c0f0e6c9..10952a6c6 100644
|
||||
--- a/src/base/ftobjs.c
|
||||
+++ b/src/base/ftobjs.c
|
||||
@@ -2527,6 +2527,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
+ /* only use lower 31 bits together with sign bit */
|
||||
+ if ( face_index > 0 )
|
||||
+ face_index &= 0x7FFFFFFFL;
|
||||
+ else
|
||||
+ {
|
||||
+ face_index &= 0x7FFFFFFFL;
|
||||
+ face_index = -face_index;
|
||||
+ }
|
||||
+
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE3(( "FT_Open_Face: " ));
|
||||
if ( face_index < 0 )
|
||||
--
|
||||
GitLab
|
||||
31
meta/recipes-graphics/freetype/freetype/CVE-2022-27406.patch
Normal file
31
meta/recipes-graphics/freetype/freetype/CVE-2022-27406.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0c2bdb01a2e1d24a3e592377a6d0822856e10df2 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Lemberg <wl@gnu.org>
|
||||
Date: Sat, 19 Mar 2022 09:37:28 +0100
|
||||
Subject: [PATCH] * src/base/ftobjs.c (FT_Request_Size): Guard `face->size`.
|
||||
|
||||
Fixes #1140.
|
||||
|
||||
CVE: CVE-2022-27406
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/freetype/freetype/-/commit/0c2bdb01a2e1d24a3e592377a6d0822856e10df2]
|
||||
Comment: No Change in any hunk
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
---
|
||||
src/base/ftobjs.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
|
||||
index 6492a1517..282c9121a 100644
|
||||
--- a/src/base/ftobjs.c
|
||||
+++ b/src/base/ftobjs.c
|
||||
@@ -3409,6 +3409,9 @@
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
+ if ( !face->size )
|
||||
+ return FT_THROW( Invalid_Size_Handle );
|
||||
+
|
||||
if ( !req || req->width < 0 || req->height < 0 ||
|
||||
req->type >= FT_SIZE_REQUEST_TYPE_MAX )
|
||||
return FT_THROW( Invalid_Argument );
|
||||
--
|
||||
GitLab
|
||||
@@ -15,6 +15,9 @@ LIC_FILES_CHKSUM = "file://docs/LICENSE.TXT;md5=4af6221506f202774ef74f64932878a1
|
||||
SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/${BPN}/${BP}.tar.xz \
|
||||
file://use-right-libtool.patch \
|
||||
file://0001-sfnt-Fix-heap-buffer-overflow-59308.patch \
|
||||
file://CVE-2022-27404.patch \
|
||||
file://CVE-2022-27405.patch \
|
||||
file://CVE-2022-27406.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "bd42e75127f8431923679480efb5ba8f"
|
||||
SRC_URI[sha256sum] = "16dbfa488a21fe827dc27eaf708f42f7aa3bb997d745d31a19781628c36ba26f"
|
||||
|
||||
38
meta/recipes-graphics/libsdl2/libsdl2/CVE-2021-33657.patch
Normal file
38
meta/recipes-graphics/libsdl2/libsdl2/CVE-2021-33657.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 8c91cf7dba5193f5ce12d06db1336515851c9ee9 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Lantinga <slouken@libsdl.org>
|
||||
Date: Tue, 30 Nov 2021 12:36:46 -0800
|
||||
Subject: [PATCH] Always create a full 256-entry map in case color values are
|
||||
out of range
|
||||
|
||||
Fixes https://github.com/libsdl-org/SDL/issues/5042
|
||||
|
||||
CVE: CVE-2021-33657
|
||||
Upstream-Status: Backport [https://github.com/libsdl-org/SDL/commit/8c91cf7dba5193f5ce12d06db1336515851c9ee9.patch]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
---
|
||||
src/video/SDL_pixels.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
|
||||
index ac04533c5d5..9bb02f771d0 100644
|
||||
--- a/src/video/SDL_pixels.c
|
||||
+++ b/src/video/SDL_pixels.c
|
||||
@@ -947,7 +947,7 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
|
||||
}
|
||||
*identical = 0;
|
||||
}
|
||||
- map = (Uint8 *) SDL_malloc(src->ncolors);
|
||||
+ map = (Uint8 *) SDL_calloc(256, sizeof(Uint8));
|
||||
if (map == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return (NULL);
|
||||
@@ -971,7 +971,7 @@ Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
|
||||
SDL_Palette *pal = src->palette;
|
||||
|
||||
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
|
||||
- map = (Uint8 *) SDL_malloc(pal->ncolors * bpp);
|
||||
+ map = (Uint8 *) SDL_calloc(256, bpp);
|
||||
if (map == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return (NULL);
|
||||
@@ -21,6 +21,7 @@ SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
|
||||
file://directfb-spurious-curly-brace-missing-e.patch \
|
||||
file://directfb-renderfillrect-fix.patch \
|
||||
file://CVE-2020-14409-14410.patch \
|
||||
file://CVE-2021-33657.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/SDL2-${PV}"
|
||||
|
||||
360
meta/recipes-graphics/wayland/libinput/CVE-2022-1215.patch
Normal file
360
meta/recipes-graphics/wayland/libinput/CVE-2022-1215.patch
Normal file
@@ -0,0 +1,360 @@
|
||||
From 2a8b8fde90d63d48ce09ddae44142674bbca1c28 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Wed, 30 Mar 2022 09:25:22 +1000
|
||||
Subject: [PATCH] evdev: strip the device name of format directives
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes a format string vulnerabilty.
|
||||
|
||||
evdev_log_message() composes a format string consisting of a fixed
|
||||
prefix (including the rendered device name) and the passed-in format
|
||||
buffer. This format string is then passed with the arguments to the
|
||||
actual log handler, which usually and eventually ends up being printf.
|
||||
|
||||
If the device name contains a printf-style format directive, these ended
|
||||
up in the format string and thus get interpreted correctly, e.g. for a
|
||||
device "Foo%sBar" the log message vs printf invocation ends up being:
|
||||
evdev_log_message(device, "some message %s", "some argument");
|
||||
printf("event9 - Foo%sBar: some message %s", "some argument");
|
||||
|
||||
This can enable an attacker to execute malicious code with the
|
||||
privileges of the process using libinput.
|
||||
|
||||
To exploit this, an attacker needs to be able to create a kernel device
|
||||
with a malicious name, e.g. through /dev/uinput or a Bluetooth device.
|
||||
|
||||
To fix this, convert any potential format directives in the device name
|
||||
by duplicating percentages.
|
||||
|
||||
Pre-rendering the device to avoid the issue altogether would be nicer
|
||||
but the current log level hooks do not easily allow for this. The device
|
||||
name is the only user-controlled part of the format string.
|
||||
|
||||
A second potential issue is the sysname of the device which is also
|
||||
sanitized.
|
||||
|
||||
This issue was found by Albin Eldstål-Ahrens and Benjamin Svensson from
|
||||
Assured AB, and independently by Lukas Lamster.
|
||||
|
||||
Fixes #752
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
(cherry picked from commit a423d7d3269dc32a87384f79e29bb5ac021c83d1)
|
||||
|
||||
CVE: CVE-2022-1215
|
||||
Upstream Status: Backport [https://gitlab.freedesktop.org/libinput/libinput/-/commit/2a8b8fde90d63d48ce09ddae44142674bbca1c28]
|
||||
Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
|
||||
|
||||
---
|
||||
meson.build | 1 +
|
||||
src/evdev.c | 31 +++++++++++------
|
||||
src/evdev.h | 6 ++--
|
||||
src/util-strings.h | 30 ++++++++++++++++
|
||||
test/litest-device-format-string.c | 56 ++++++++++++++++++++++++++++++
|
||||
test/litest.h | 1 +
|
||||
test/test-utils.c | 26 ++++++++++++++
|
||||
7 files changed, 139 insertions(+), 12 deletions(-)
|
||||
create mode 100644 test/litest-device-format-string.c
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 90f528e6..1f6159e7 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -787,6 +787,7 @@
|
||||
'test/litest-device-dell-canvas-totem-touch.c',
|
||||
'test/litest-device-elantech-touchpad.c',
|
||||
'test/litest-device-elan-tablet.c',
|
||||
+ 'test/litest-device-format-string.c',
|
||||
'test/litest-device-generic-singletouch.c',
|
||||
'test/litest-device-gpio-keys.c',
|
||||
'test/litest-device-huion-pentablet.c',
|
||||
diff --git a/src/evdev.c b/src/evdev.c
|
||||
index 6d81f58f..d1c35c07 100644
|
||||
--- a/src/evdev.c
|
||||
+++ b/src/evdev.c
|
||||
@@ -2356,19 +2356,19 @@ evdev_device_create(struct libinput_seat *seat,
|
||||
struct libinput *libinput = seat->libinput;
|
||||
struct evdev_device *device = NULL;
|
||||
int rc;
|
||||
- int fd;
|
||||
+ int fd = -1;
|
||||
int unhandled_device = 0;
|
||||
const char *devnode = udev_device_get_devnode(udev_device);
|
||||
- const char *sysname = udev_device_get_sysname(udev_device);
|
||||
+ char *sysname = str_sanitize(udev_device_get_sysname(udev_device));
|
||||
|
||||
if (!devnode) {
|
||||
log_info(libinput, "%s: no device node associated\n", sysname);
|
||||
- return NULL;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
if (udev_device_should_be_ignored(udev_device)) {
|
||||
log_debug(libinput, "%s: device is ignored\n", sysname);
|
||||
- return NULL;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
/* Use non-blocking mode so that we can loop on read on
|
||||
@@ -2382,13 +2382,15 @@ evdev_device_create(struct libinput_seat *seat,
|
||||
sysname,
|
||||
devnode,
|
||||
strerror(-fd));
|
||||
- return NULL;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
if (!evdev_device_have_same_syspath(udev_device, fd))
|
||||
goto err;
|
||||
|
||||
device = zalloc(sizeof *device);
|
||||
+ device->sysname = sysname;
|
||||
+ sysname = NULL;
|
||||
|
||||
libinput_device_init(&device->base, seat);
|
||||
libinput_seat_ref(seat);
|
||||
@@ -2411,6 +2413,9 @@ evdev_device_create(struct libinput_seat *seat,
|
||||
device->dispatch = NULL;
|
||||
device->fd = fd;
|
||||
device->devname = libevdev_get_name(device->evdev);
|
||||
+ /* the log_prefix_name is used as part of a printf format string and
|
||||
+ * must not contain % directives, see evdev_log_msg */
|
||||
+ device->log_prefix_name = str_sanitize(device->devname);
|
||||
device->scroll.threshold = 5.0; /* Default may be overridden */
|
||||
device->scroll.direction_lock_threshold = 5.0; /* Default may be overridden */
|
||||
device->scroll.direction = 0;
|
||||
@@ -2238,9 +2238,14 @@
|
||||
return device;
|
||||
|
||||
err:
|
||||
- close_restricted(libinput, fd);
|
||||
- if (device)
|
||||
- evdev_device_destroy(device);
|
||||
+ if (fd >= 0) {
|
||||
+ close_restricted(libinput, fd);
|
||||
+ if (device) {
|
||||
+ unhandled_device = device->seat_caps == 0;
|
||||
+ evdev_device_destroy(device);
|
||||
+ }
|
||||
+ }
|
||||
+ free(sysname);
|
||||
|
||||
return unhandled_device ? EVDEV_UNHANDLED_DEVICE : NULL;
|
||||
}
|
||||
@@ -2469,7 +2478,7 @@ evdev_device_get_output(struct evdev_device *device)
|
||||
const char *
|
||||
evdev_device_get_sysname(struct evdev_device *device)
|
||||
{
|
||||
- return udev_device_get_sysname(device->udev_device);
|
||||
+ return device->sysname;
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -3066,6 +3075,8 @@ evdev_device_destroy(struct evdev_device *device)
|
||||
if (device->base.group)
|
||||
libinput_device_group_unref(device->base.group);
|
||||
|
||||
+ free(device->log_prefix_name);
|
||||
+ free(device->sysname);
|
||||
free(device->output_name);
|
||||
filter_destroy(device->pointer.filter);
|
||||
libinput_timer_destroy(&device->scroll.timer);
|
||||
diff --git a/src/evdev.h b/src/evdev.h
|
||||
index c7d130f8..980c5943 100644
|
||||
--- a/src/evdev.h
|
||||
+++ b/src/evdev.h
|
||||
@@ -169,6 +169,8 @@ struct evdev_device {
|
||||
struct udev_device *udev_device;
|
||||
char *output_name;
|
||||
const char *devname;
|
||||
+ char *log_prefix_name;
|
||||
+ char *sysname;
|
||||
bool was_removed;
|
||||
int fd;
|
||||
enum evdev_device_seat_capability seat_caps;
|
||||
@@ -786,7 +788,7 @@ evdev_log_msg(struct evdev_device *device,
|
||||
sizeof(buf),
|
||||
"%-7s - %s%s%s",
|
||||
evdev_device_get_sysname(device),
|
||||
- (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->devname : "",
|
||||
+ (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->log_prefix_name : "",
|
||||
(priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : "",
|
||||
format);
|
||||
|
||||
@@ -824,7 +826,7 @@ evdev_log_msg_ratelimit(struct evdev_device *device,
|
||||
sizeof(buf),
|
||||
"%-7s - %s%s%s",
|
||||
evdev_device_get_sysname(device),
|
||||
- (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->devname : "",
|
||||
+ (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->log_prefix_name : "",
|
||||
(priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : "",
|
||||
format);
|
||||
|
||||
diff --git a/src/util-strings.h b/src/util-strings.h
|
||||
index 2a15fab3..d5a84146 100644
|
||||
--- a/src/util-strings.h
|
||||
+++ b/src/util-strings.h
|
||||
@@ -42,6 +42,7 @@
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
+#include "util-macros.h"
|
||||
|
||||
#define streq(s1, s2) (strcmp((s1), (s2)) == 0)
|
||||
#define strneq(s1, s2, n) (strncmp((s1), (s2), (n)) == 0)
|
||||
@@ -312,3 +313,31 @@
|
||||
free(result);
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
+/**
|
||||
+ * Return a copy of str with all % converted to %% to make the string
|
||||
+ * acceptable as printf format.
|
||||
+ */
|
||||
+static inline char *
|
||||
+str_sanitize(const char *str)
|
||||
+{
|
||||
+ if (!str)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!strchr(str, '%'))
|
||||
+ return strdup(str);
|
||||
+
|
||||
+ size_t slen = min(strlen(str), 512);
|
||||
+ char *sanitized = zalloc(2 * slen + 1);
|
||||
+ const char *src = str;
|
||||
+ char *dst = sanitized;
|
||||
+
|
||||
+ for (size_t i = 0; i < slen; i++) {
|
||||
+ if (*src == '%')
|
||||
+ *dst++ = '%';
|
||||
+ *dst++ = *src++;
|
||||
+ }
|
||||
+ *dst = '\0';
|
||||
+
|
||||
+ return sanitized;
|
||||
+}
|
||||
diff --git a/test/litest-device-format-string.c b/test/litest-device-format-string.c
|
||||
new file mode 100644
|
||||
index 00000000..aed15db4
|
||||
--- /dev/null
|
||||
+++ b/test/litest-device-format-string.c
|
||||
@@ -0,0 +1,56 @@
|
||||
+
|
||||
+/*
|
||||
+ * Copyright © 2013 Red Hat, Inc.
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a
|
||||
+ * copy of this software and associated documentation files (the "Software"),
|
||||
+ * to deal in the Software without restriction, including without limitation
|
||||
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
+ * and/or sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice (including the next
|
||||
+ * paragraph) shall be included in all copies or substantial portions of the
|
||||
+ * Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
+ * DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#include "litest.h"
|
||||
+#include "litest-int.h"
|
||||
+
|
||||
+static struct input_id input_id = {
|
||||
+ .bustype = 0x3,
|
||||
+ .vendor = 0x0123,
|
||||
+ .product = 0x0456,
|
||||
+};
|
||||
+
|
||||
+static int events[] = {
|
||||
+ EV_KEY, BTN_LEFT,
|
||||
+ EV_KEY, BTN_RIGHT,
|
||||
+ EV_KEY, BTN_MIDDLE,
|
||||
+ EV_REL, REL_X,
|
||||
+ EV_REL, REL_Y,
|
||||
+ EV_REL, REL_WHEEL,
|
||||
+ EV_REL, REL_WHEEL_HI_RES,
|
||||
+ -1 , -1,
|
||||
+};
|
||||
+
|
||||
+TEST_DEVICE("mouse-format-string",
|
||||
+ .type = LITEST_MOUSE_FORMAT_STRING,
|
||||
+ .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
|
||||
+ .interface = NULL,
|
||||
+
|
||||
+ .name = "Evil %s %d %x Mouse %p %",
|
||||
+ .id = &input_id,
|
||||
+ .absinfo = NULL,
|
||||
+ .events = events,
|
||||
+)
|
||||
diff --git a/test/litest.h b/test/litest.h
|
||||
index 4982e516..1b1daa90 100644
|
||||
--- a/test/litest.h
|
||||
+++ b/test/litest.h
|
||||
@@ -303,6 +303,7 @@
|
||||
LITEST_ALPS_3FG,
|
||||
LITEST_ELAN_TABLET,
|
||||
LITEST_ABSINFO_OVERRIDE,
|
||||
+ LITEST_MOUSE_FORMAT_STRING,
|
||||
};
|
||||
|
||||
#define LITEST_DEVICELESS -2
|
||||
diff --git a/test/test-utils.c b/test/test-utils.c
|
||||
index 989adecd..e80754be 100644
|
||||
--- a/test/test-utils.c
|
||||
+++ b/test/test-utils.c
|
||||
@@ -1267,6 +1267,31 @@ START_TEST(strstartswith_test)
|
||||
}
|
||||
END_TEST
|
||||
|
||||
+START_TEST(strsanitize_test)
|
||||
+{
|
||||
+ struct strsanitize_test {
|
||||
+ const char *string;
|
||||
+ const char *expected;
|
||||
+ } tests[] = {
|
||||
+ { "foobar", "foobar" },
|
||||
+ { "", "" },
|
||||
+ { "%", "%%" },
|
||||
+ { "%%%%", "%%%%%%%%" },
|
||||
+ { "x %s", "x %%s" },
|
||||
+ { "x %", "x %%" },
|
||||
+ { "%sx", "%%sx" },
|
||||
+ { "%s%s", "%%s%%s" },
|
||||
+ { NULL, NULL },
|
||||
+ };
|
||||
+
|
||||
+ for (struct strsanitize_test *t = tests; t->string; t++) {
|
||||
+ char *sanitized = str_sanitize(t->string);
|
||||
+ ck_assert_str_eq(sanitized, t->expected);
|
||||
+ free(sanitized);
|
||||
+ }
|
||||
+}
|
||||
+END_TEST
|
||||
+
|
||||
START_TEST(list_test_insert)
|
||||
{
|
||||
struct list_test {
|
||||
@@ -1138,6 +1138,7 @@
|
||||
tcase_add_test(tc, strsplit_test);
|
||||
tcase_add_test(tc, kvsplit_double_test);
|
||||
tcase_add_test(tc, strjoin_test);
|
||||
+ tcase_add_test(tc, strsanitize_test);
|
||||
tcase_add_test(tc, time_conversion);
|
||||
|
||||
tcase_add_test(tc, list_test_insert);
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -14,6 +14,7 @@ DEPENDS = "libevdev udev mtdev"
|
||||
|
||||
SRC_URI = "http://www.freedesktop.org/software/${BPN}/${BP}.tar.xz \
|
||||
file://determinism.patch \
|
||||
file://CVE-2022-1215.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "eb6bd2907ad33d53954d70dfb881a643"
|
||||
SRC_URI[sha256sum] = "971c3fbfb624f95c911adeb2803c372e4e3647d1b98f278f660051f834597747"
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 71514e74f35f2b51ca24062573d6d913525b30db Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Weihmann <kweihmann@outlook.com>
|
||||
Date: Mon, 9 May 2022 12:57:57 +0200
|
||||
Subject: [PATCH] Makefile: replace mkdir by install
|
||||
|
||||
mkdir -p creates paths that are bound to user's settings and therefore
|
||||
can lead to different file mode bits of the base paths accross different
|
||||
machines.
|
||||
Use install instead, as this tool is not prone to such behavior.
|
||||
|
||||
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
|
||||
Upstream-Status: Submitted [https://lore.kernel.org/linux-firmware/PR2PR09MB310088EA719E6D7CA5C268F1A8C69@PR2PR09MB3100.eurprd09.prod.outlook.com/]
|
||||
---
|
||||
Makefile | 2 +-
|
||||
carl9170fw/toolchain/Makefile | 4 ++--
|
||||
copy-firmware.sh | 6 +++---
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index e1c362f..83a0ec6 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -9,5 +9,5 @@ check:
|
||||
@./check_whence.py
|
||||
|
||||
install:
|
||||
- mkdir -p $(DESTDIR)$(FIRMWAREDIR)
|
||||
+ install -d $(DESTDIR)$(FIRMWAREDIR)
|
||||
./copy-firmware.sh $(DESTDIR)$(FIRMWAREDIR)
|
||||
diff --git a/carl9170fw/toolchain/Makefile b/carl9170fw/toolchain/Makefile
|
||||
index 2b25ffe..aaea8e8 100644
|
||||
--- a/carl9170fw/toolchain/Makefile
|
||||
+++ b/carl9170fw/toolchain/Makefile
|
||||
@@ -46,14 +46,14 @@ src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER)
|
||||
ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss $@
|
||||
|
||||
binutils: src/binutils-$(BINUTILS_VER)
|
||||
- mkdir -p build/binutils
|
||||
+ install -d build/binutils
|
||||
cd build/binutils; \
|
||||
$(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst; \
|
||||
$(MAKE) -j3; \
|
||||
$(MAKE) install
|
||||
|
||||
gcc: src/gcc-$(GCC_VER) binutils
|
||||
- mkdir -p build/gcc
|
||||
+ install -d build/gcc
|
||||
cd build/gcc; \
|
||||
$(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst -enable-languages=c --without-pkgversion --with-newlib; \
|
||||
$(MAKE) -j3; \
|
||||
diff --git a/copy-firmware.sh b/copy-firmware.sh
|
||||
index 9b46b63..bbacb92 100755
|
||||
--- a/copy-firmware.sh
|
||||
+++ b/copy-firmware.sh
|
||||
@@ -34,7 +34,7 @@ done
|
||||
grep '^File:' WHENCE | sed -e's/^File: *//g' -e's/"//g' | while read f; do
|
||||
test -f "$f" || continue
|
||||
$verbose "copying file $f"
|
||||
- mkdir -p $destdir/$(dirname "$f")
|
||||
+ install -d $destdir/$(dirname "$f")
|
||||
cp -d "$f" $destdir/"$f"
|
||||
done
|
||||
|
||||
@@ -42,7 +42,7 @@ grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; d
|
||||
if test -L "$f"; then
|
||||
test -f "$destdir/$f" && continue
|
||||
$verbose "copying link $f"
|
||||
- mkdir -p $destdir/$(dirname "$f")
|
||||
+ install -d $destdir/$(dirname "$f")
|
||||
cp -d "$f" $destdir/"$f"
|
||||
|
||||
if test "x$d" != "x"; then
|
||||
@@ -63,7 +63,7 @@ grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; d
|
||||
fi
|
||||
else
|
||||
$verbose "creating link $f -> $d"
|
||||
- mkdir -p $destdir/$(dirname "$f")
|
||||
+ install -d $destdir/$(dirname "$f")
|
||||
ln -sf "$d" "$destdir/$f"
|
||||
fi
|
||||
done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -132,7 +132,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \
|
||||
file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \
|
||||
file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \
|
||||
file://WHENCE;md5=4cf67d71a21887c682c3989a4318745e \
|
||||
file://WHENCE;md5=d3eb82686904888f8bbbe8d865371404 \
|
||||
"
|
||||
|
||||
# These are not common licenses, set NO_GENERIC_LICENSE for them
|
||||
@@ -203,9 +203,12 @@ NO_GENERIC_LICENSE[WHENCE] = "WHENCE"
|
||||
|
||||
PE = "1"
|
||||
|
||||
SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz"
|
||||
SRC_URI = "\
|
||||
${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz \
|
||||
file://0001-Makefile-replace-mkdir-by-install.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "020b11f6412f4956f5a6f98de7d41867d2b30ea0ce81b1e2d206ec9840363849"
|
||||
SRC_URI[sha256sum] = "376e0b3d7b4f8aaa2abf7f5ab74803dcf14b06b94e3d841b1467cd9a2848255e"
|
||||
|
||||
inherit allarch
|
||||
|
||||
@@ -352,7 +355,7 @@ FILES_${PN}-carl9170 = " \
|
||||
RDEPENDS_${PN}-carl9170 += "${PN}-gplv2-license"
|
||||
|
||||
# For QualCommAthos
|
||||
LICENSE_${PN}-ar3k = "Firmware-qualcommAthos_ar3k"
|
||||
LICENSE_${PN}-ar3k = "Firmware-qualcommAthos_ar3k & Firmware-atheros_firmware"
|
||||
LICENSE_${PN}-ar3k-license = "Firmware-qualcommAthos_ar3k"
|
||||
LICENSE_${PN}-ath10k = "Firmware-qualcommAthos_ath10k"
|
||||
LICENSE_${PN}-ath10k-license = "Firmware-qualcommAthos_ath10k"
|
||||
@@ -376,7 +379,7 @@ FILES_${PN}-qca = " \
|
||||
${nonarch_base_libdir}/firmware/qca \
|
||||
"
|
||||
|
||||
RDEPENDS_${PN}-ar3k += "${PN}-ar3k-license"
|
||||
RDEPENDS_${PN}-ar3k += "${PN}-ar3k-license ${PN}-atheros-license"
|
||||
RDEPENDS_${PN}-ath10k += "${PN}-ath10k-license"
|
||||
RDEPENDS_${PN}-ath11k += "${PN}-ath10k-license"
|
||||
RDEPENDS_${PN}-qca += "${PN}-ath10k-license"
|
||||
@@ -11,13 +11,13 @@ python () {
|
||||
raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
|
||||
}
|
||||
|
||||
SRCREV_machine ?= "5b157591793811a9d226866d9f8acde817339fe9"
|
||||
SRCREV_meta ?= "6a12bea7312868626062fe8206ce3c5bcb7c9101"
|
||||
SRCREV_machine ?= "24d323fa0e17bcd62c9cfe1fd4153c304a06f38c"
|
||||
SRCREV_meta ?= "3fecb08507e286d1458497faaf31d1a07cc7d373"
|
||||
|
||||
SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
|
||||
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
|
||||
|
||||
LINUX_VERSION ?= "5.4.190"
|
||||
LINUX_VERSION ?= "5.4.192"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
|
||||
|
||||
require recipes-kernel/linux/linux-yocto.inc
|
||||
|
||||
LINUX_VERSION ?= "5.4.190"
|
||||
LINUX_VERSION ?= "5.4.192"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
|
||||
KMETA = "kernel-meta"
|
||||
KCONF_BSP_AUDIT_LEVEL = "2"
|
||||
|
||||
SRCREV_machine_qemuarm ?= "25567bdff9816844f3b9e09cdb490d7c7bfb4edb"
|
||||
SRCREV_machine ?= "36a8131ee4418c5f8883ff165833776746e61e84"
|
||||
SRCREV_meta ?= "6a12bea7312868626062fe8206ce3c5bcb7c9101"
|
||||
SRCREV_machine_qemuarm ?= "460de085c07ab1a221317e6804c13657456c5368"
|
||||
SRCREV_machine ?= "b414a2fc5ce5f68c33d297d9cde4fef5437b773b"
|
||||
SRCREV_meta ?= "3fecb08507e286d1458497faaf31d1a07cc7d373"
|
||||
|
||||
PV = "${LINUX_VERSION}+git${SRCPV}"
|
||||
|
||||
|
||||
@@ -12,16 +12,16 @@ KBRANCH_qemux86 ?= "v5.4/standard/base"
|
||||
KBRANCH_qemux86-64 ?= "v5.4/standard/base"
|
||||
KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64"
|
||||
|
||||
SRCREV_machine_qemuarm ?= "c4efc0b0650c3d2a7a321a6ba5fe612b7d14bd3f"
|
||||
SRCREV_machine_qemuarm64 ?= "c5b5ccb7df29d44c4e3d71d0e2ccf3e8a462a7f0"
|
||||
SRCREV_machine_qemumips ?= "addad5fd9e5c386a4b06938ae73de42292d552be"
|
||||
SRCREV_machine_qemuppc ?= "ee0f3e8a7de91b0520da532f87f8deeb91a92e27"
|
||||
SRCREV_machine_qemuriscv64 ?= "d9d6c6e0d0a9a52f9acd488036a5ed6409352f44"
|
||||
SRCREV_machine_qemux86 ?= "d9d6c6e0d0a9a52f9acd488036a5ed6409352f44"
|
||||
SRCREV_machine_qemux86-64 ?= "d9d6c6e0d0a9a52f9acd488036a5ed6409352f44"
|
||||
SRCREV_machine_qemumips64 ?= "971edcacc688c0deb078f4643125c5c5372010c5"
|
||||
SRCREV_machine ?= "d9d6c6e0d0a9a52f9acd488036a5ed6409352f44"
|
||||
SRCREV_meta ?= "6a12bea7312868626062fe8206ce3c5bcb7c9101"
|
||||
SRCREV_machine_qemuarm ?= "68a2ce69aaf2e8d96eef4aaccd70fc0ef7368a46"
|
||||
SRCREV_machine_qemuarm64 ?= "acfed0930d37a714d705645ff7cfbfbd0ad040e7"
|
||||
SRCREV_machine_qemumips ?= "e7046a2c8972e925cd2e6ac7f392abe87cbec5f5"
|
||||
SRCREV_machine_qemuppc ?= "997e06e0af674c27627eaa76a60b2f63cb16f38d"
|
||||
SRCREV_machine_qemuriscv64 ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_machine_qemux86 ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_machine_qemux86-64 ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_machine_qemumips64 ?= "7b526cde12d78604b6f1e1ad62da31dcb729f35f"
|
||||
SRCREV_machine ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_meta ?= "3fecb08507e286d1458497faaf31d1a07cc7d373"
|
||||
|
||||
# remap qemuarm to qemuarma15 for the 5.4 kernel
|
||||
# KMACHINE_qemuarm ?= "qemuarma15"
|
||||
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
|
||||
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
|
||||
LINUX_VERSION ?= "5.4.190"
|
||||
LINUX_VERSION ?= "5.4.192"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
|
||||
36
meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2022-1475.patch
Normal file
36
meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2022-1475.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From: Michael Niedermayer <michael@niedermayer.cc>
|
||||
Date: Sun, 27 Feb 2022 14:43:04 +0100
|
||||
Subject: [PATCH] avcodec/g729_parser: Check channels
|
||||
|
||||
Fixes: signed integer overflow: 10 * 808464428 cannot be represented in type 'int'
|
||||
Fixes: assertion failure
|
||||
Fixes: ticket9651
|
||||
|
||||
Reviewed-by: Paul B Mahol <onemda@gmail.com>
|
||||
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
||||
(cherry picked from commit 757da974b21833529cc41bdcc9684c29660cdfa8)
|
||||
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
||||
|
||||
CVE: CVE-2022-1475
|
||||
Upstream-Status: Backport [https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=e9e2ddbc6c78cc18b76093617f82c920e58a8d1f]
|
||||
Comment: Patch is refreshed as per ffmpeg codebase
|
||||
Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
|
||||
|
||||
---
|
||||
libavcodec/g729_parser.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
Index: ffmpeg-4.2.2/libavcodec/g729_parser.c
|
||||
===================================================================
|
||||
--- a/libavcodec/g729_parser.c
|
||||
+++ b/libavcodec/g729_parser.c
|
||||
@@ -48,6 +48,9 @@ static int g729_parse(AVCodecParserConte
|
||||
av_assert1(avctx->codec_id == AV_CODEC_ID_G729);
|
||||
/* FIXME: replace this heuristic block_size with more precise estimate */
|
||||
s->block_size = (avctx->bit_rate < 8000) ? G729D_6K4_BLOCK_SIZE : G729_8K_BLOCK_SIZE;
|
||||
+ // channels > 2 is invalid, we pass the packet on unchanged
|
||||
+ if (avctx->channels > 2)
|
||||
+ s->block_size = 0;
|
||||
s->block_size *= avctx->channels;
|
||||
s->duration = avctx->frame_size;
|
||||
}
|
||||
@@ -29,6 +29,7 @@ SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
|
||||
file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \
|
||||
file://CVE-2021-3566.patch \
|
||||
file://CVE-2021-38291.patch \
|
||||
file://CVE-2022-1475.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "348956fc2faa57a2f79bbb84ded9fbc3"
|
||||
SRC_URI[sha256sum] = "cb754255ab0ee2ea5f66f8850e1bd6ad5cac1cd855d0a2f4990fb8c668b0d29c"
|
||||
|
||||
39
meta/recipes-multimedia/libtiff/files/CVE-2022-0865.patch
Normal file
39
meta/recipes-multimedia/libtiff/files/CVE-2022-0865.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From a1c933dabd0e1c54a412f3f84ae0aa58115c6067 Mon Sep 17 00:00:00 2001
|
||||
From: Even Rouault <even.rouault@spatialys.com>
|
||||
Date: Thu, 24 Feb 2022 22:26:02 +0100
|
||||
Subject: [PATCH] tif_jbig.c: fix crash when reading a file with multiple IFD
|
||||
in memory-mapped mode and when bit reversal is needed (fixes #385)
|
||||
|
||||
CVE: CVE-2022-0865
|
||||
Upstream-Status: Backport [https://sources.debian.org/src/tiff/4.1.0+git191117-2%7Edeb10u4/debian/patches/CVE-2022-0865.patch/]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
Comment: No change in any hunk
|
||||
|
||||
---
|
||||
libtiff/tif_jbig.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/libtiff/tif_jbig.c b/libtiff/tif_jbig.c
|
||||
index 74086338..8bfa4cef 100644
|
||||
--- a/libtiff/tif_jbig.c
|
||||
+++ b/libtiff/tif_jbig.c
|
||||
@@ -208,6 +208,16 @@ int TIFFInitJBIG(TIFF* tif, int scheme)
|
||||
*/
|
||||
tif->tif_flags |= TIFF_NOBITREV;
|
||||
tif->tif_flags &= ~TIFF_MAPPED;
|
||||
+ /* We may have read from a previous IFD and thus set TIFF_BUFFERMMAP and
|
||||
+ * cleared TIFF_MYBUFFER. It is necessary to restore them to their initial
|
||||
+ * value to be consistent with the state of a non-memory mapped file.
|
||||
+ */
|
||||
+ if (tif->tif_flags&TIFF_BUFFERMMAP) {
|
||||
+ tif->tif_rawdata = NULL;
|
||||
+ tif->tif_rawdatasize = 0;
|
||||
+ tif->tif_flags &= ~TIFF_BUFFERMMAP;
|
||||
+ tif->tif_flags |= TIFF_MYBUFFER;
|
||||
+ }
|
||||
|
||||
/* Setup the function pointers for encode, decode, and cleanup. */
|
||||
tif->tif_setupdecode = JBIGSetupDecode;
|
||||
--
|
||||
GitLab
|
||||
|
||||
217
meta/recipes-multimedia/libtiff/files/CVE-2022-0891.patch
Normal file
217
meta/recipes-multimedia/libtiff/files/CVE-2022-0891.patch
Normal file
@@ -0,0 +1,217 @@
|
||||
From 232282fd8f9c21eefe8d2d2b96cdbbb172fe7b7c Mon Sep 17 00:00:00 2001
|
||||
From: Su Laus <sulau@freenet.de>
|
||||
Date: Tue, 8 Mar 2022 17:02:44 +0000
|
||||
Subject: [PATCH] tiffcrop: fix issue #380 and #382 heap buffer overflow in
|
||||
extractImageSection
|
||||
|
||||
CVE: CVE-2022-0891
|
||||
Upstream-Status: Backport [https://sources.debian.org/src/tiff/4.1.0+git191117-2%7Edeb10u4/debian/patches/CVE-2022-0891.patch/]
|
||||
Comment: No change in any hunk
|
||||
Signed-off-by: Sana Kazi <Sana.Kazi@kpit.com>
|
||||
---
|
||||
tools/tiffcrop.c | 92 +++++++++++++++++++-----------------------------
|
||||
1 file changed, 36 insertions(+), 56 deletions(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index f2e5474a..e62bcc71 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -105,8 +105,8 @@
|
||||
* of messages to monitor progess without enabling dump logs.
|
||||
*/
|
||||
|
||||
-static char tiffcrop_version_id[] = "2.4";
|
||||
-static char tiffcrop_rev_date[] = "12-13-2010";
|
||||
+static char tiffcrop_version_id[] = "2.4.1";
|
||||
+static char tiffcrop_rev_date[] = "03-03-2010";
|
||||
|
||||
#include "tif_config.h"
|
||||
#include "tiffiop.h"
|
||||
@@ -6670,10 +6670,10 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
#ifdef DEVELMODE
|
||||
uint32 img_length;
|
||||
#endif
|
||||
- uint32 j, shift1, shift2, trailing_bits;
|
||||
+ uint32 j, shift1, trailing_bits;
|
||||
uint32 row, first_row, last_row, first_col, last_col;
|
||||
uint32 src_offset, dst_offset, row_offset, col_offset;
|
||||
- uint32 offset1, offset2, full_bytes;
|
||||
+ uint32 offset1, full_bytes;
|
||||
uint32 sect_width;
|
||||
#ifdef DEVELMODE
|
||||
uint32 sect_length;
|
||||
@@ -6683,7 +6683,6 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
#ifdef DEVELMODE
|
||||
int k;
|
||||
unsigned char bitset;
|
||||
- static char *bitarray = NULL;
|
||||
#endif
|
||||
|
||||
img_width = image->width;
|
||||
@@ -6701,17 +6700,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
dst_offset = 0;
|
||||
|
||||
#ifdef DEVELMODE
|
||||
- if (bitarray == NULL)
|
||||
- {
|
||||
- if ((bitarray = (char *)malloc(img_width)) == NULL)
|
||||
- {
|
||||
- TIFFError ("", "DEBUG: Unable to allocate debugging bitarray");
|
||||
- return (-1);
|
||||
- }
|
||||
- }
|
||||
+ char bitarray[39];
|
||||
#endif
|
||||
|
||||
- /* rows, columns, width, length are expressed in pixels */
|
||||
+ /* rows, columns, width, length are expressed in pixels
|
||||
+ * first_row, last_row, .. are index into image array starting at 0 to width-1,
|
||||
+ * last_col shall be also extracted. */
|
||||
first_row = section->y1;
|
||||
last_row = section->y2;
|
||||
first_col = section->x1;
|
||||
@@ -6721,9 +6715,14 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
#ifdef DEVELMODE
|
||||
sect_length = last_row - first_row + 1;
|
||||
#endif
|
||||
- img_rowsize = ((img_width * bps + 7) / 8) * spp;
|
||||
- full_bytes = (sect_width * spp * bps) / 8; /* number of COMPLETE bytes per row in section */
|
||||
- trailing_bits = (sect_width * bps) % 8;
|
||||
+ /* The read function loadImage() used copy separate plane data into a buffer as interleaved
|
||||
+ * samples rather than separate planes so the same logic works to extract regions
|
||||
+ * regardless of the way the data are organized in the input file.
|
||||
+ * Furthermore, bytes and bits are arranged in buffer according to COMPRESSION=1 and FILLORDER=1
|
||||
+ */
|
||||
+ img_rowsize = (((img_width * spp * bps) + 7) / 8); /* row size in full bytes of source image */
|
||||
+ full_bytes = (sect_width * spp * bps) / 8; /* number of COMPLETE bytes per row in section */
|
||||
+ trailing_bits = (sect_width * spp * bps) % 8; /* trailing bits within the last byte of destination buffer */
|
||||
|
||||
#ifdef DEVELMODE
|
||||
TIFFError ("", "First row: %d, last row: %d, First col: %d, last col: %d\n",
|
||||
@@ -6736,10 +6735,9 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
|
||||
if ((bps % 8) == 0)
|
||||
{
|
||||
- col_offset = first_col * spp * bps / 8;
|
||||
+ col_offset = (first_col * spp * bps) / 8;
|
||||
for (row = first_row; row <= last_row; row++)
|
||||
{
|
||||
- /* row_offset = row * img_width * spp * bps / 8; */
|
||||
row_offset = row * img_rowsize;
|
||||
src_offset = row_offset + col_offset;
|
||||
|
||||
@@ -6752,14 +6750,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
}
|
||||
else
|
||||
{ /* bps != 8 */
|
||||
- shift1 = spp * ((first_col * bps) % 8);
|
||||
- shift2 = spp * ((last_col * bps) % 8);
|
||||
+ shift1 = ((first_col * spp * bps) % 8); /* shift1 = bits to skip in the first byte of source buffer*/
|
||||
for (row = first_row; row <= last_row; row++)
|
||||
{
|
||||
/* pull out the first byte */
|
||||
row_offset = row * img_rowsize;
|
||||
- offset1 = row_offset + (first_col * bps / 8);
|
||||
- offset2 = row_offset + (last_col * bps / 8);
|
||||
+ offset1 = row_offset + ((first_col * spp * bps) / 8); /* offset1 = offset into source of byte with first bits to be extracted */
|
||||
|
||||
#ifdef DEVELMODE
|
||||
for (j = 0, k = 7; j < 8; j++, k--)
|
||||
@@ -6771,12 +6767,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
sprintf(&bitarray[9], " ");
|
||||
for (j = 10, k = 7; j < 18; j++, k--)
|
||||
{
|
||||
- bitset = *(src_buff + offset2) & (((unsigned char)1 << k)) ? 1 : 0;
|
||||
+ bitset = *(src_buff + offset1 + full_bytes) & (((unsigned char)1 << k)) ? 1 : 0;
|
||||
sprintf(&bitarray[j], (bitset) ? "1" : "0");
|
||||
}
|
||||
bitarray[18] = '\0';
|
||||
- TIFFError ("", "Row: %3d Offset1: %d, Shift1: %d, Offset2: %d, Shift2: %d\n",
|
||||
- row, offset1, shift1, offset2, shift2);
|
||||
+ TIFFError ("", "Row: %3d Offset1: %"PRIu32", Shift1: %"PRIu32", Offset2: %"PRIu32", Trailing_bits: %"PRIu32"\n",
|
||||
+ row, offset1, shift1, offset1+full_bytes, trailing_bits);
|
||||
#endif
|
||||
|
||||
bytebuff1 = bytebuff2 = 0;
|
||||
@@ -6800,11 +6796,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
|
||||
if (trailing_bits != 0)
|
||||
{
|
||||
- bytebuff2 = src_buff[offset2] & ((unsigned char)255 << (7 - shift2));
|
||||
+ /* Only copy higher bits of samples and mask lower bits of not wanted column samples to zero */
|
||||
+ bytebuff2 = src_buff[offset1 + full_bytes] & ((unsigned char)255 << (8 - trailing_bits));
|
||||
sect_buff[dst_offset] = bytebuff2;
|
||||
#ifdef DEVELMODE
|
||||
TIFFError ("", " Trailing bits src offset: %8d, Dst offset: %8d\n",
|
||||
- offset2, dst_offset);
|
||||
+ offset1 + full_bytes, dst_offset);
|
||||
for (j = 30, k = 7; j < 38; j++, k--)
|
||||
{
|
||||
bitset = *(sect_buff + dst_offset) & (((unsigned char)1 << k)) ? 1 : 0;
|
||||
@@ -6823,8 +6820,10 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
#endif
|
||||
for (j = 0; j <= full_bytes; j++)
|
||||
{
|
||||
- bytebuff1 = src_buff[offset1 + j] & ((unsigned char)255 >> shift1);
|
||||
- bytebuff2 = src_buff[offset1 + j + 1] & ((unsigned char)255 << (7 - shift1));
|
||||
+ /* Skip the first shift1 bits and shift the source up by shift1 bits before save to destination.*/
|
||||
+ /* Attention: src_buff size needs to be some bytes larger than image size, because could read behind image here. */
|
||||
+ bytebuff1 = src_buff[offset1 + j] & ((unsigned char)255 >> shift1);
|
||||
+ bytebuff2 = src_buff[offset1 + j + 1] & ((unsigned char)255 << (8 - shift1));
|
||||
sect_buff[dst_offset + j] = (bytebuff1 << shift1) | (bytebuff2 >> (8 - shift1));
|
||||
}
|
||||
#ifdef DEVELMODE
|
||||
@@ -6840,36 +6839,17 @@ extractImageSection(struct image_data *image, struct pageseg *section,
|
||||
#endif
|
||||
dst_offset += full_bytes;
|
||||
|
||||
+ /* Copy the trailing_bits for the last byte in the destination buffer.
|
||||
+ Could come from one ore two bytes of the source buffer. */
|
||||
if (trailing_bits != 0)
|
||||
{
|
||||
#ifdef DEVELMODE
|
||||
- TIFFError ("", " Trailing bits src offset: %8d, Dst offset: %8d\n", offset1 + full_bytes, dst_offset);
|
||||
-#endif
|
||||
- if (shift2 > shift1)
|
||||
- {
|
||||
- bytebuff1 = src_buff[offset1 + full_bytes] & ((unsigned char)255 << (7 - shift2));
|
||||
- bytebuff2 = bytebuff1 & ((unsigned char)255 << shift1);
|
||||
- sect_buff[dst_offset] = bytebuff2;
|
||||
-#ifdef DEVELMODE
|
||||
- TIFFError ("", " Shift2 > Shift1\n");
|
||||
+ TIFFError("", " Trailing bits %4"PRIu32" src offset: %8"PRIu32", Dst offset: %8"PRIu32"\n", trailing_bits, offset1 + full_bytes, dst_offset);
|
||||
#endif
|
||||
+ /* More than necessary bits are already copied into last destination buffer,
|
||||
+ * only masking of last byte in destination buffer is necessary.*/
|
||||
+ sect_buff[dst_offset] &= ((uint8_t)0xFF << (8 - trailing_bits));
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- if (shift2 < shift1)
|
||||
- {
|
||||
- bytebuff2 = ((unsigned char)255 << (shift1 - shift2 - 1));
|
||||
- sect_buff[dst_offset] &= bytebuff2;
|
||||
-#ifdef DEVELMODE
|
||||
- TIFFError ("", " Shift2 < Shift1\n");
|
||||
-#endif
|
||||
- }
|
||||
-#ifdef DEVELMODE
|
||||
- else
|
||||
- TIFFError ("", " Shift2 == Shift1\n");
|
||||
-#endif
|
||||
- }
|
||||
- }
|
||||
#ifdef DEVELMODE
|
||||
sprintf(&bitarray[28], " ");
|
||||
sprintf(&bitarray[29], " ");
|
||||
@@ -7022,7 +7002,7 @@ writeImageSections(TIFF *in, TIFF *out, struct image_data *image,
|
||||
width = sections[i].x2 - sections[i].x1 + 1;
|
||||
length = sections[i].y2 - sections[i].y1 + 1;
|
||||
sectsize = (uint32)
|
||||
- ceil((width * image->bps + 7) / (double)8) * image->spp * length;
|
||||
+ ceil((width * image->bps * image->spp + 7) / (double)8) * length;
|
||||
/* allocate a buffer if we don't have one already */
|
||||
if (createImageSection(sectsize, sect_buff_ptr))
|
||||
{
|
||||
--
|
||||
GitLab
|
||||
94
meta/recipes-multimedia/libtiff/files/CVE-2022-0907.patch
Normal file
94
meta/recipes-multimedia/libtiff/files/CVE-2022-0907.patch
Normal file
@@ -0,0 +1,94 @@
|
||||
From 40b00cfb32256d377608b4d4cd30fac338d0a0bc Mon Sep 17 00:00:00 2001
|
||||
From: Augustus <wangdw.augustus@qq.com>
|
||||
Date: Mon, 7 Mar 2022 18:21:49 +0800
|
||||
Subject: [PATCH] add checks for return value of limitMalloc (#392)
|
||||
|
||||
CVE: CVE-2022-0907
|
||||
Upstream-Status: Backport [https://sources.debian.org/src/tiff/4.1.0+git191117-2%7Edeb10u4/debian/patches/CVE-2022-0907.patch/]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
Comment: No change in any hunk
|
||||
|
||||
---
|
||||
tools/tiffcrop.c | 33 +++++++++++++++++++++------------
|
||||
1 file changed, 21 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index f2e5474a..9b8acc7e 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -7337,7 +7337,11 @@ createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr)
|
||||
if (!sect_buff)
|
||||
{
|
||||
sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
|
||||
- *sect_buff_ptr = sect_buff;
|
||||
+ if (!sect_buff)
|
||||
+ {
|
||||
+ TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
|
||||
+ return (-1);
|
||||
+ }
|
||||
_TIFFmemset(sect_buff, 0, sectsize);
|
||||
}
|
||||
else
|
||||
@@ -7353,15 +7357,15 @@ createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr)
|
||||
else
|
||||
sect_buff = new_buff;
|
||||
|
||||
+ if (!sect_buff)
|
||||
+ {
|
||||
+ TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
|
||||
+ return (-1);
|
||||
+ }
|
||||
_TIFFmemset(sect_buff, 0, sectsize);
|
||||
}
|
||||
}
|
||||
|
||||
- if (!sect_buff)
|
||||
- {
|
||||
- TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
|
||||
- return (-1);
|
||||
- }
|
||||
prev_sectsize = sectsize;
|
||||
*sect_buff_ptr = sect_buff;
|
||||
|
||||
@@ -7628,7 +7632,11 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
|
||||
if (!crop_buff)
|
||||
{
|
||||
crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
- *crop_buff_ptr = crop_buff;
|
||||
+ if (!crop_buff)
|
||||
+ {
|
||||
+ TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
|
||||
+ return (-1);
|
||||
+ }
|
||||
_TIFFmemset(crop_buff, 0, cropsize);
|
||||
prev_cropsize = cropsize;
|
||||
}
|
||||
@@ -7644,15 +7652,15 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
|
||||
}
|
||||
else
|
||||
crop_buff = new_buff;
|
||||
+ if (!crop_buff)
|
||||
+ {
|
||||
+ TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
|
||||
+ return (-1);
|
||||
+ }
|
||||
_TIFFmemset(crop_buff, 0, cropsize);
|
||||
}
|
||||
}
|
||||
|
||||
- if (!crop_buff)
|
||||
- {
|
||||
- TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
|
||||
- return (-1);
|
||||
- }
|
||||
*crop_buff_ptr = crop_buff;
|
||||
|
||||
if (crop->crop_mode & CROP_INVERT)
|
||||
@@ -9211,3 +9219,4 @@ invertImage(uint16_t photometric, uint16_t spp, uint16_t bps, uint32_t width, ui
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
+
|
||||
--
|
||||
GitLab
|
||||
|
||||
34
meta/recipes-multimedia/libtiff/files/CVE-2022-0908.patch
Normal file
34
meta/recipes-multimedia/libtiff/files/CVE-2022-0908.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From a95b799f65064e4ba2e2dfc206808f86faf93e85 Mon Sep 17 00:00:00 2001
|
||||
From: Even Rouault <even.rouault@spatialys.com>
|
||||
Date: Thu, 17 Feb 2022 15:28:43 +0100
|
||||
Subject: [PATCH] TIFFFetchNormalTag(): avoid calling memcpy() with a null
|
||||
source pointer and size of zero (fixes #383)
|
||||
|
||||
CVE: CVE-2022-0908
|
||||
Upstream-Status: Backport [https://sources.debian.org/src/tiff/4.1.0+git191117-2%7Edeb10u4/debian/patches/CVE-2022-0908.patch/]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
Comment: No change in any hunk
|
||||
|
||||
---
|
||||
libtiff/tif_dirread.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
|
||||
index 50ebf8ac..2ec44a4f 100644
|
||||
--- a/libtiff/tif_dirread.c
|
||||
+++ b/libtiff/tif_dirread.c
|
||||
@@ -5021,7 +5021,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
_TIFFfree(data);
|
||||
return(0);
|
||||
}
|
||||
- _TIFFmemcpy(o,data,(uint32)dp->tdir_count);
|
||||
+ if (dp->tdir_count > 0 )
|
||||
+ {
|
||||
+ _TIFFmemcpy(o,data,(uint32)dp->tdir_count);
|
||||
+ }
|
||||
o[(uint32)dp->tdir_count]=0;
|
||||
if (data!=0)
|
||||
_TIFFfree(data);
|
||||
--
|
||||
GitLab
|
||||
|
||||
37
meta/recipes-multimedia/libtiff/files/CVE-2022-0909.patch
Normal file
37
meta/recipes-multimedia/libtiff/files/CVE-2022-0909.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 32ea0722ee68f503b7a3f9b2d557acb293fc8cde Mon Sep 17 00:00:00 2001
|
||||
From: 4ugustus <wangdw.augustus@qq.com>
|
||||
Date: Tue, 8 Mar 2022 16:22:04 +0000
|
||||
Subject: [PATCH] fix the FPE in tiffcrop (#393)
|
||||
|
||||
CVE: CVE-2022-0909
|
||||
Upstream-Status: Backport [https://sources.debian.org/src/tiff/4.1.0+git191117-2%7Edeb10u4/debian/patches/CVE-2022-0909.patch/]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
Comment: No change in any hunk
|
||||
|
||||
---
|
||||
libtiff/tif_dir.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
|
||||
index 57055ca9..59b346ca 100644
|
||||
--- a/libtiff/tif_dir.c
|
||||
+++ b/libtiff/tif_dir.c
|
||||
@@ -334,13 +334,13 @@ _TIFFVSetField(TIFF* tif, uint32_t tag, va_list ap)
|
||||
break;
|
||||
case TIFFTAG_XRESOLUTION:
|
||||
dblval = va_arg(ap, double);
|
||||
- if( dblval < 0 )
|
||||
+ if( dblval != dblval || dblval < 0 )
|
||||
goto badvaluedouble;
|
||||
td->td_xresolution = _TIFFClampDoubleToFloat( dblval );
|
||||
break;
|
||||
case TIFFTAG_YRESOLUTION:
|
||||
dblval = va_arg(ap, double);
|
||||
- if( dblval < 0 )
|
||||
+ if( dblval != dblval || dblval < 0 )
|
||||
goto badvaluedouble;
|
||||
td->td_yresolution = _TIFFClampDoubleToFloat( dblval );
|
||||
break;
|
||||
--
|
||||
GitLab
|
||||
|
||||
58
meta/recipes-multimedia/libtiff/files/CVE-2022-0924.patch
Normal file
58
meta/recipes-multimedia/libtiff/files/CVE-2022-0924.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 88d79a45a31c74cba98c697892fed5f7db8b963a Mon Sep 17 00:00:00 2001
|
||||
From: 4ugustus <wangdw.augustus@qq.com>
|
||||
Date: Thu, 10 Mar 2022 08:48:00 +0000
|
||||
Subject: [PATCH] fix heap buffer overflow in tiffcp (#278)
|
||||
|
||||
CVE: CVE-2022-0924
|
||||
Upstream-Status: Backport [https://sources.debian.org/src/tiff/4.1.0+git191117-2%7Edeb10u4/debian/patches/CVE-2022-0924.patch/]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
Comment: No change in any hunk
|
||||
|
||||
---
|
||||
tools/tiffcp.c | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
|
||||
index 224583e0..aa32b118 100644
|
||||
--- a/tools/tiffcp.c
|
||||
+++ b/tools/tiffcp.c
|
||||
@@ -1524,12 +1524,27 @@ DECLAREwriteFunc(writeBufferToSeparateSt
|
||||
tdata_t obuf;
|
||||
tstrip_t strip = 0;
|
||||
tsample_t s;
|
||||
+ uint16 bps = 0, bytes_per_sample;
|
||||
|
||||
obuf = _TIFFmalloc(stripsize);
|
||||
if (obuf == NULL)
|
||||
return (0);
|
||||
_TIFFmemset(obuf, 0, stripsize);
|
||||
(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||
+ (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);
|
||||
+ if( bps == 0 )
|
||||
+ {
|
||||
+ TIFFError(TIFFFileName(out), "Error, cannot read BitsPerSample");
|
||||
+ _TIFFfree(obuf);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if( (bps % 8) != 0 )
|
||||
+ {
|
||||
+ TIFFError(TIFFFileName(out), "Error, cannot handle BitsPerSample that is not a multiple of 8");
|
||||
+ _TIFFfree(obuf);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ bytes_per_sample = bps/8;
|
||||
for (s = 0; s < spp; s++) {
|
||||
uint32 row;
|
||||
for (row = 0; row < imagelength; row += rowsperstrip) {
|
||||
@@ -1539,7 +1539,7 @@ DECLAREwriteFunc(writeBufferToSeparateSt
|
||||
|
||||
cpContigBufToSeparateBuf(
|
||||
obuf, (uint8*) buf + row*rowsize + s,
|
||||
- nrows, imagewidth, 0, 0, spp, 1);
|
||||
+ nrows, imagewidth, 0, 0, spp, bytes_per_sample);
|
||||
if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) {
|
||||
TIFFError(TIFFFileName(out),
|
||||
"Error, can't write strip %u",
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -18,6 +18,12 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
|
||||
file://0001-tiffset-fix-global-buffer-overflow-for-ASCII-tags-wh.patch \
|
||||
file://561599c99f987dc32ae110370cfdd7df7975586b.patch \
|
||||
file://eecb0712f4c3a5b449f70c57988260a667ddbdef.patch \
|
||||
file://CVE-2022-0865.patch \
|
||||
file://CVE-2022-0908.patch \
|
||||
file://CVE-2022-0907.patch \
|
||||
file://CVE-2022-0909.patch \
|
||||
file://CVE-2022-0891.patch \
|
||||
file://CVE-2022-0924.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "2165e7aba557463acc0664e71a3ed424"
|
||||
SRC_URI[sha256sum] = "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634"
|
||||
|
||||
@@ -165,7 +165,7 @@ do_configure() {
|
||||
|
||||
# D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
|
||||
rm -f ${WORKDIR}/user-config.jam
|
||||
echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
|
||||
echo 'using gcc : : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
|
||||
|
||||
# If we want Python then we need to tell Boost *exactly* where to find it
|
||||
if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then
|
||||
|
||||
148
meta/recipes-support/curl/curl/CVE-2022-22576.patch
Normal file
148
meta/recipes-support/curl/curl/CVE-2022-22576.patch
Normal file
@@ -0,0 +1,148 @@
|
||||
From 852aa5ad351ea53e5f01d2f44b5b4370c2bf5425 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Monnerat <patrick@monnerat.net>
|
||||
Date: Mon, 25 Apr 2022 11:44:05 +0200
|
||||
Subject: [PATCH] url: check sasl additional parameters for connection reuse.
|
||||
|
||||
Also move static function safecmp() as non-static Curl_safecmp() since
|
||||
its purpose is needed at several places.
|
||||
|
||||
Bug: https://curl.se/docs/CVE-2022-22576.html
|
||||
|
||||
CVE-2022-22576
|
||||
|
||||
Closes #8746
|
||||
---
|
||||
lib/strcase.c | 10 ++++++++++
|
||||
lib/strcase.h | 2 ++
|
||||
lib/url.c | 13 ++++++++++++-
|
||||
lib/urldata.h | 1 +
|
||||
lib/vtls/vtls.c | 21 ++++++---------------
|
||||
5 files changed, 31 insertions(+), 16 deletions(-)
|
||||
|
||||
CVE: CVE-2022-22576
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/852aa5ad351ea53e5f01d2f44b5b4370c2bf5425.patch]
|
||||
Comment: Refreshed patch
|
||||
Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>
|
||||
|
||||
diff --git a/lib/strcase.c b/lib/strcase.c
|
||||
index dd46ca1ba0e5..692a3f14aee7 100644
|
||||
--- a/lib/strcase.c
|
||||
+++ b/lib/strcase.c
|
||||
@@ -251,6 +251,16 @@
|
||||
} while(*src++ && --n);
|
||||
}
|
||||
|
||||
+/* Compare case-sensitive NUL-terminated strings, taking care of possible
|
||||
+ * null pointers. Return true if arguments match.
|
||||
+ */
|
||||
+bool Curl_safecmp(char *a, char *b)
|
||||
+{
|
||||
+ if(a && b)
|
||||
+ return !strcmp(a, b);
|
||||
+ return !a && !b;
|
||||
+}
|
||||
+
|
||||
/* --- public functions --- */
|
||||
|
||||
int curl_strequal(const char *first, const char *second)
|
||||
diff --git a/lib/strcase.h b/lib/strcase.h
|
||||
index b234d3815220..2635f5117e99 100644
|
||||
--- a/lib/strcase.h
|
||||
+++ b/lib/strcase.h
|
||||
@@ -48,4 +48,6 @@
|
||||
void Curl_strntoupper(char *dest, const char *src, size_t n);
|
||||
void Curl_strntolower(char *dest, const char *src, size_t n);
|
||||
|
||||
+bool Curl_safecmp(char *a, char *b);
|
||||
+
|
||||
#endif /* HEADER_CURL_STRCASE_H */
|
||||
diff --git a/lib/url.c b/lib/url.c
|
||||
index 9a988b4d58d8..e1647b133854 100644
|
||||
--- a/lib/url.c
|
||||
+++ b/lib/url.c
|
||||
@@ -730,6 +730,7 @@
|
||||
Curl_safefree(conn->allocptr.host);
|
||||
Curl_safefree(conn->allocptr.cookiehost);
|
||||
Curl_safefree(conn->allocptr.rtsp_transport);
|
||||
+ Curl_safefree(conn->oauth_bearer);
|
||||
Curl_safefree(conn->trailer);
|
||||
Curl_safefree(conn->host.rawalloc); /* host name buffer */
|
||||
Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */
|
||||
@@ -1251,7 +1252,9 @@
|
||||
/* This protocol requires credentials per connection,
|
||||
so verify that we're using the same name and password as well */
|
||||
if(strcmp(needle->user, check->user) ||
|
||||
- strcmp(needle->passwd, check->passwd)) {
|
||||
+ strcmp(needle->passwd, check->passwd) ||
|
||||
+ !Curl_safecmp(needle->sasl_authzid, check->sasl_authzid) ||
|
||||
+ !Curl_safecmp(needle->oauth_bearer, check->oauth_bearer)) {
|
||||
/* one of them was different */
|
||||
continue;
|
||||
}
|
||||
@@ -3392,6 +3395,14 @@
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ if(data->set.str[STRING_BEARER]) {
|
||||
+ conn->oauth_bearer = strdup(data->set.str[STRING_BEARER]);
|
||||
+ if(!conn->oauth_bearer) {
|
||||
+ result = CURLE_OUT_OF_MEMORY;
|
||||
+ goto out;
|
||||
+ }
|
||||
}
|
||||
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
diff --git a/lib/urldata.h b/lib/urldata.h
|
||||
index 07eb19b87034..1d89b8d7fa68 100644
|
||||
--- a/lib/urldata.h
|
||||
+++ b/lib/urldata.h
|
||||
@@ -949,6 +949,8 @@
|
||||
|
||||
char *sasl_authzid; /* authorisation identity string, allocated */
|
||||
|
||||
+ char *oauth_bearer; /* OAUTH2 bearer, allocated */
|
||||
+
|
||||
int httpversion; /* the HTTP version*10 reported by the server */
|
||||
int rtspversion; /* the RTSP version*10 reported by the server */
|
||||
|
||||
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
|
||||
index 03b85ba065e5..a40ac06f684f 100644
|
||||
--- a/lib/vtls/vtls.c
|
||||
+++ b/lib/vtls/vtls.c
|
||||
@@ -82,15 +82,6 @@
|
||||
else \
|
||||
dest->var = NULL;
|
||||
|
||||
-static bool safecmp(char *a, char *b)
|
||||
-{
|
||||
- if(a && b)
|
||||
- return !strcmp(a, b);
|
||||
- else if(!a && !b)
|
||||
- return TRUE; /* match */
|
||||
- return FALSE; /* no match */
|
||||
-}
|
||||
-
|
||||
|
||||
bool
|
||||
Curl_ssl_config_matches(struct ssl_primary_config* data,
|
||||
@@ -101,12 +101,12 @@
|
||||
(data->verifypeer == needle->verifypeer) &&
|
||||
(data->verifyhost == needle->verifyhost) &&
|
||||
(data->verifystatus == needle->verifystatus) &&
|
||||
- safecmp(data->CApath, needle->CApath) &&
|
||||
- safecmp(data->CAfile, needle->CAfile) &&
|
||||
- safecmp(data->issuercert, needle->issuercert) &&
|
||||
- safecmp(data->clientcert, needle->clientcert) &&
|
||||
- safecmp(data->random_file, needle->random_file) &&
|
||||
- safecmp(data->egdsocket, needle->egdsocket) &&
|
||||
+ Curl_safecmp(data->CApath, needle->CApath) &&
|
||||
+ Curl_safecmp(data->CAfile, needle->CAfile) &&
|
||||
+ Curl_safecmp(data->issuercert, needle->issuercert) &&
|
||||
+ Curl_safecmp(data->clientcert, needle->clientcert) &&
|
||||
+ Curl_safecmp(data->random_file, needle->random_file) &&
|
||||
+ Curl_safecmp(data->egdsocket, needle->egdsocket) &&
|
||||
Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) &&
|
||||
Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) &&
|
||||
Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key))
|
||||
39
meta/recipes-support/curl/curl/CVE-2022-27775.patch
Normal file
39
meta/recipes-support/curl/curl/CVE-2022-27775.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 058f98dc3fe595f21dc26a5b9b1699e519ba5705 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 25 Apr 2022 11:48:00 +0200
|
||||
Subject: [PATCH] conncache: include the zone id in the "bundle" hashkey
|
||||
|
||||
Make connections to two separate IPv6 zone ids create separate
|
||||
connections.
|
||||
|
||||
Reported-by: Harry Sintonen
|
||||
Bug: https://curl.se/docs/CVE-2022-27775.html
|
||||
Closes #8747
|
||||
---
|
||||
lib/conncache.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
CVE: CVE-2022-27775
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/058f98dc3fe595f21dc26a5b9b1699e519ba5705.patch]
|
||||
Comment: Refreshed patch
|
||||
Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>
|
||||
|
||||
diff --git a/lib/conncache.c b/lib/conncache.c
|
||||
index ec669b971dc3..8948b53fa500 100644
|
||||
--- a/lib/conncache.c
|
||||
+++ b/lib/conncache.c
|
||||
@@ -156,8 +156,12 @@
|
||||
/* report back which name we used */
|
||||
*hostp = hostname;
|
||||
|
||||
- /* put the number first so that the hostname gets cut off if too long */
|
||||
- msnprintf(buf, len, "%ld%s", port, hostname);
|
||||
+ /* put the numbers first so that the hostname gets cut off if too long */
|
||||
+#ifdef ENABLE_IPV6
|
||||
+ msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
|
||||
+#else
|
||||
+ msnprintf(buf, len, "%ld/%s", port, hostname);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Returns number of connections currently held in the connection cache.
|
||||
114
meta/recipes-support/curl/curl/CVE-2022-27776.patch
Normal file
114
meta/recipes-support/curl/curl/CVE-2022-27776.patch
Normal file
@@ -0,0 +1,114 @@
|
||||
From 6e659993952aa5f90f48864be84a1bbb047fc258 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 25 Apr 2022 13:05:40 +0200
|
||||
Subject: [PATCH] http: avoid auth/cookie on redirects same host diff port
|
||||
|
||||
CVE-2022-27776
|
||||
|
||||
Reported-by: Harry Sintonen
|
||||
Bug: https://curl.se/docs/CVE-2022-27776.html
|
||||
Closes #8749
|
||||
---
|
||||
lib/http.c | 34 ++++++++++++++++++++++------------
|
||||
lib/urldata.h | 16 +++++++++-------
|
||||
2 files changed, 31 insertions(+), 19 deletions(-)
|
||||
|
||||
CVE: CVE-2022-27776
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/6e659993952aa5f90f48864be84a1bbb047fc258.patch]
|
||||
Comment: Refreshed patch
|
||||
Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>
|
||||
|
||||
diff --git a/lib/http.c b/lib/http.c
|
||||
index ce79fc4e31c8..f0476f3b9272 100644
|
||||
--- a/lib/http.c
|
||||
+++ b/lib/http.c
|
||||
@@ -731,6 +731,21 @@
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * allow_auth_to_host() tells if autentication, cookies or other "sensitive
|
||||
+ * data" can (still) be sent to this host.
|
||||
+ */
|
||||
+static bool allow_auth_to_host(struct Curl_easy *data)
|
||||
+{
|
||||
+ struct connectdata *conn = data->conn;
|
||||
+ return (!data->state.this_is_a_follow ||
|
||||
+ data->set.allow_auth_to_other_hosts ||
|
||||
+ (data->state.first_host &&
|
||||
+ strcasecompare(data->state.first_host, conn->host.name) &&
|
||||
+ (data->state.first_remote_port == conn->remote_port) &&
|
||||
+ (data->state.first_remote_protocol == conn->handler->protocol)));
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Curl_http_output_auth() setups the authentication headers for the
|
||||
* host/proxy and the correct authentication
|
||||
@@ -799,15 +799,12 @@
|
||||
with it */
|
||||
authproxy->done = TRUE;
|
||||
|
||||
- /* To prevent the user+password to get sent to other than the original
|
||||
- host due to a location-follow, we do some weirdo checks here */
|
||||
- if(!data->state.this_is_a_follow ||
|
||||
- conn->bits.netrc ||
|
||||
- !data->state.first_host ||
|
||||
- data->set.allow_auth_to_other_hosts ||
|
||||
- strcasecompare(data->state.first_host, conn->host.name)) {
|
||||
+ /* To prevent the user+password to get sent to other than the original host
|
||||
+ due to a location-follow */
|
||||
+ if(allow_auth_to_host(data)
|
||||
+ || conn->bits.netrc
|
||||
+ )
|
||||
result = output_auth_headers(conn, authhost, request, path, FALSE);
|
||||
- }
|
||||
else
|
||||
authhost->done = TRUE;
|
||||
|
||||
@@ -1879,10 +1891,7 @@
|
||||
checkprefix("Cookie:", compare)) &&
|
||||
/* be careful of sending this potentially sensitive header to
|
||||
other hosts */
|
||||
- (data->state.this_is_a_follow &&
|
||||
- data->state.first_host &&
|
||||
- !data->set.allow_auth_to_other_hosts &&
|
||||
- !strcasecompare(data->state.first_host, conn->host.name)))
|
||||
+ !allow_auth_to_host(data))
|
||||
;
|
||||
else {
|
||||
result = Curl_add_bufferf(&req_buffer, "%s\r\n", compare);
|
||||
@@ -2065,6 +2074,7 @@
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
data->state.first_remote_port = conn->remote_port;
|
||||
+ data->state.first_remote_protocol = conn->handler->protocol;
|
||||
}
|
||||
|
||||
if((conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_FTP)) &&
|
||||
diff --git a/lib/urldata.h b/lib/urldata.h
|
||||
index 1d89b8d7fa68..ef2174d9e727 100644
|
||||
--- a/lib/urldata.h
|
||||
+++ b/lib/urldata.h
|
||||
@@ -1342,13 +1342,15 @@
|
||||
char *ulbuf; /* allocated upload buffer or NULL */
|
||||
curl_off_t current_speed; /* the ProgressShow() function sets this,
|
||||
bytes / second */
|
||||
- char *first_host; /* host name of the first (not followed) request.
|
||||
- if set, this should be the host name that we will
|
||||
- sent authorization to, no else. Used to make Location:
|
||||
- following not keep sending user+password... This is
|
||||
- strdup() data.
|
||||
- */
|
||||
- int first_remote_port; /* remote port of the first (not followed) request */
|
||||
+
|
||||
+ /* host name, port number and protocol of the first (not followed) request.
|
||||
+ if set, this should be the host name that we will sent authorization to,
|
||||
+ no else. Used to make Location: following not keep sending user+password.
|
||||
+ This is strdup()ed data. */
|
||||
+ char *first_host;
|
||||
+ int first_remote_port;
|
||||
+ unsigned int first_remote_protocol;
|
||||
+
|
||||
struct curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
|
||||
long sessionage; /* number of the most recent session */
|
||||
unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
|
||||
@@ -25,6 +25,9 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
|
||||
file://CVE-2021-22946-pre1.patch \
|
||||
file://CVE-2021-22946.patch \
|
||||
file://CVE-2021-22947.patch \
|
||||
file://CVE-2022-27776.patch \
|
||||
file://CVE-2022-27775.patch \
|
||||
file://CVE-2022-22576.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"
|
||||
|
||||
50
meta/recipes-support/fribidi/fribidi/CVE-2022-25308.patch
Normal file
50
meta/recipes-support/fribidi/fribidi/CVE-2022-25308.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From ad3a19e6372b1e667128ed1ea2f49919884587e1 Mon Sep 17 00:00:00 2001
|
||||
From: Akira TAGOH <akira@tagoh.org>
|
||||
Date: Thu, 17 Feb 2022 17:30:12 +0900
|
||||
Subject: [PATCH] Fix the stack buffer overflow issue
|
||||
|
||||
strlen() could returns 0. Without a conditional check for len,
|
||||
accessing S_ pointer with len - 1 may causes a stack buffer overflow.
|
||||
|
||||
AddressSanitizer reports this like:
|
||||
==1219243==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdce043c1f at pc 0x000000403547 bp 0x7ffdce0
|
||||
43b30 sp 0x7ffdce043b28
|
||||
READ of size 1 at 0x7ffdce043c1f thread T0
|
||||
#0 0x403546 in main ../bin/fribidi-main.c:393
|
||||
#1 0x7f226804e58f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f)
|
||||
#2 0x7f226804e648 in __libc_start_main_impl (/lib64/libc.so.6+0x2d648)
|
||||
#3 0x4036f4 in _start (/tmp/fribidi/build/bin/fribidi+0x4036f4)
|
||||
|
||||
Address 0x7ffdce043c1f is located in stack of thread T0 at offset 63 in frame
|
||||
#0 0x4022bf in main ../bin/fribidi-main.c:193
|
||||
|
||||
This frame has 5 object(s):
|
||||
[32, 36) 'option_index' (line 233)
|
||||
[48, 52) 'base' (line 386)
|
||||
[64, 65064) 'S_' (line 375) <== Memory access at offset 63 underflows this variable
|
||||
[65328, 130328) 'outstring' (line 385)
|
||||
[130592, 390592) 'logical' (line 384)
|
||||
|
||||
This fixes https://github.com/fribidi/fribidi/issues/181
|
||||
|
||||
CVE: CVE-2022-25308
|
||||
Upstream-Status: Backport [https://github.com/fribidi/fribidi/commit/ad3a19e6372b1e667128ed1ea2f49919884587e1]
|
||||
Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
|
||||
|
||||
---
|
||||
bin/fribidi-main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c
|
||||
index 3cf9fe1..3ae4fb6 100644
|
||||
--- a/bin/fribidi-main.c
|
||||
+++ b/bin/fribidi-main.c
|
||||
@@ -390,7 +390,7 @@ FRIBIDI_END_IGNORE_DEPRECATIONS
|
||||
S_[sizeof (S_) - 1] = 0;
|
||||
len = strlen (S_);
|
||||
/* chop */
|
||||
- if (S_[len - 1] == '\n')
|
||||
+ if (len > 0 && S_[len - 1] == '\n')
|
||||
{
|
||||
len--;
|
||||
S_[len] = '\0';
|
||||
31
meta/recipes-support/fribidi/fribidi/CVE-2022-25309.patch
Normal file
31
meta/recipes-support/fribidi/fribidi/CVE-2022-25309.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From f22593b82b5d1668d1997dbccd10a9c31ffea3b3 Mon Sep 17 00:00:00 2001
|
||||
From: Dov Grobgeld <dov.grobgeld@gmail.com>
|
||||
Date: Fri, 25 Mar 2022 09:09:49 +0300
|
||||
Subject: [PATCH] Protected against garbage in the CapRTL encoder
|
||||
|
||||
CVE: CVE-2022-25309
|
||||
Upstream-Status: Backport [https://github.com/fribidi/fribidi/commit/f22593b82b5d1668d1997dbccd10a9c31ffea3b3]
|
||||
Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
|
||||
|
||||
---
|
||||
lib/fribidi-char-sets-cap-rtl.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/fribidi-char-sets-cap-rtl.c b/lib/fribidi-char-sets-cap-rtl.c
|
||||
index b0c0e4a..f74e010 100644
|
||||
--- a/lib/fribidi-char-sets-cap-rtl.c
|
||||
+++ b/lib/fribidi-char-sets-cap-rtl.c
|
||||
@@ -232,7 +232,12 @@ fribidi_cap_rtl_to_unicode (
|
||||
}
|
||||
}
|
||||
else
|
||||
- us[j++] = caprtl_to_unicode[(int) s[i]];
|
||||
+ {
|
||||
+ if ((int)s[i] < 0)
|
||||
+ us[j++] = '?';
|
||||
+ else
|
||||
+ us[j++] = caprtl_to_unicode[(int) s[i]];
|
||||
+ }
|
||||
}
|
||||
|
||||
return j;
|
||||
30
meta/recipes-support/fribidi/fribidi/CVE-2022-25310.patch
Normal file
30
meta/recipes-support/fribidi/fribidi/CVE-2022-25310.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 175850b03e1af251d705c1d04b2b9b3c1c06e48f Mon Sep 17 00:00:00 2001
|
||||
From: Akira TAGOH <akira@tagoh.org>
|
||||
Date: Thu, 17 Feb 2022 19:06:10 +0900
|
||||
Subject: [PATCH] Fix SEGV issue in fribidi_remove_bidi_marks
|
||||
|
||||
Escape from fribidi_remove_bidi_marks() immediately if str is null.
|
||||
|
||||
This fixes https://github.com/fribidi/fribidi/issues/183
|
||||
|
||||
CVE: CVE-2022-25310
|
||||
Upstream-Status: Backport [https://github.com/fribidi/fribidi/commit/175850b03e1af251d705c1d04b2b9b3c1c06e48f]
|
||||
Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
|
||||
|
||||
---
|
||||
lib/fribidi.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/fribidi.c b/lib/fribidi.c
|
||||
index f5da0da..70bdab2 100644
|
||||
--- a/lib/fribidi.c
|
||||
+++ b/lib/fribidi.c
|
||||
@@ -74,7 +74,7 @@ fribidi_remove_bidi_marks (
|
||||
fribidi_boolean status = false;
|
||||
|
||||
if UNLIKELY
|
||||
- (len == 0)
|
||||
+ (len == 0 || str == NULL)
|
||||
{
|
||||
status = true;
|
||||
goto out;
|
||||
@@ -10,6 +10,9 @@ LICENSE = "LGPLv2.1+"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=a916467b91076e631dd8edb7424769c7"
|
||||
|
||||
SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.xz \
|
||||
file://CVE-2022-25308.patch \
|
||||
file://CVE-2022-25309.patch \
|
||||
file://CVE-2022-25310.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "1b767c259c3cd8e0c8496970f63c22dc"
|
||||
SRC_URI[sha256sum] = "c5e47ea9026fb60da1944da9888b4e0a18854a0e2410bbfe7ad90a054d36e0c7"
|
||||
|
||||
59
meta/recipes-support/libpcre/libpcre2/CVE-2022-1586.patch
Normal file
59
meta/recipes-support/libpcre/libpcre2/CVE-2022-1586.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
From 233c4248550d0c1d9bfee42198d5ee0855b7d413 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 23 May 2022 13:52:39 +0530
|
||||
Subject: [PATCH] CVE-2022-1586
|
||||
|
||||
Upstream-Status: Backport from https://github.com/PCRE2Project/pcre2/commit/50a51cb7e67268e6ad417eb07c9de9bfea5cc55a
|
||||
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
ChangeLog | 3 +++
|
||||
src/pcre2_jit_compile.c | 2 +-
|
||||
src/pcre2_jit_test.c | 4 ++++
|
||||
3 files changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 0926c29..b5d72dc 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,6 +1,9 @@
|
||||
Change Log for PCRE2
|
||||
--------------------
|
||||
|
||||
+23. Fixed a unicode properrty matching issue in JIT. The character was not
|
||||
+fully read in caseless matching.
|
||||
+
|
||||
|
||||
Version 10.34 21-November-2019
|
||||
------------------------------
|
||||
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
|
||||
index f564127..5d43865 100644
|
||||
--- a/src/pcre2_jit_compile.c
|
||||
+++ b/src/pcre2_jit_compile.c
|
||||
@@ -7119,7 +7119,7 @@ while (*cc != XCL_END)
|
||||
{
|
||||
SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);
|
||||
cc++;
|
||||
- if (*cc == PT_CLIST)
|
||||
+ if (*cc == PT_CLIST && *cc == XCL_PROP)
|
||||
{
|
||||
other_cases = PRIV(ucd_caseless_sets) + cc[1];
|
||||
while (*other_cases != NOTACHAR)
|
||||
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
|
||||
index a9b3880..9df87fd 100644
|
||||
--- a/src/pcre2_jit_test.c
|
||||
+++ b/src/pcre2_jit_test.c
|
||||
@@ -408,6 +408,10 @@ static struct regression_test_case regression_test_cases[] = {
|
||||
{ MUP, A, 0, 0 | F_PROPERTY, "[\xc3\xa2-\xc3\xa6\xc3\x81-\xc3\x84\xe2\x80\xa8-\xe2\x80\xa9\xe6\x92\xad\\p{Zs}]{2,}", "\xe2\x80\xa7\xe2\x80\xa9\xe6\x92\xad \xe6\x92\xae" },
|
||||
{ MUP, A, 0, 0 | F_PROPERTY, "[\\P{L&}]{2}[^\xc2\x85-\xc2\x89\\p{Ll}\\p{Lu}]{2}", "\xc3\xa9\xe6\x92\xad.a\xe6\x92\xad|\xc2\x8a#" },
|
||||
{ PCRE2_UCP, 0, 0, 0 | F_PROPERTY, "[a-b\\s]{2,5}[^a]", "AB baaa" },
|
||||
+ { MUP, 0, 0, 0 | F_NOMATCH, "[^\\p{Hangul}\\p{Z}]", " " },
|
||||
+ { MUP, 0, 0, 0, "[\\p{Lu}\\P{Latin}]+", "c\xEA\xA4\xAE,A,b" },
|
||||
+ { MUP, 0, 0, 0, "[\\x{a92e}\\p{Lu}\\P{Latin}]+", "c\xEA\xA4\xAE,A,b" },
|
||||
+ { CMUP, 0, 0, 0, "[^S]\\B", "\xe2\x80\x8a" },
|
||||
|
||||
/* Possible empty brackets. */
|
||||
{ MU, A, 0, 0, "(?:|ab||bc|a)+d", "abcxabcabd" },
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://LICENCE;md5=b1588d3bb4cb0e1f5a597d908f8c5b37"
|
||||
|
||||
SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/pcre2-${PV}.tar.bz2 \
|
||||
file://pcre-cross.patch \
|
||||
file://CVE-2022-1586.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "d280b62ded13f9ccf2fac16ee5286366"
|
||||
|
||||
@@ -21,8 +21,8 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
|
||||
file://racefix.patch \
|
||||
"
|
||||
|
||||
PV .= ".4681"
|
||||
SRCREV = "15f74fab653a784548d5d966644926b47ba2cfa7"
|
||||
PV .= ".5034"
|
||||
SRCREV = "5a6ec10cc80ab02eeff644ab19b82312630ea855"
|
||||
|
||||
# Remove when 8.3 is out
|
||||
UPSTREAM_VERSION_UNKNOWN = "1"
|
||||
|
||||
@@ -87,21 +87,10 @@ if [ $# -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$email_to" ]; then
|
||||
if ! [ -x "$(command -v phantomjs)" ]; then
|
||||
echo "ERROR: Sending email needs phantomjs."
|
||||
exit 1
|
||||
fi
|
||||
if ! [ -x "$(command -v optipng)" ]; then
|
||||
echo "ERROR: Sending email needs optipng."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Open a file descriptor for flock and acquire lock
|
||||
LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock"
|
||||
if ! exec 3> "$LOCK_FILE"; then
|
||||
echo "ERROR: Unable to open lock file"
|
||||
echo "ERROR: Unable to open loemack file"
|
||||
exit 1
|
||||
fi
|
||||
if ! flock -n 3; then
|
||||
@@ -226,7 +215,7 @@ if [ -n "$results_repo" ]; then
|
||||
if [ -n "$email_to" ]; then
|
||||
echo "Emailing test report"
|
||||
os_name=`get_os_release_var PRETTY_NAME`
|
||||
"$script_dir"/oe-build-perf-report-email.py --to "$email_to" --subject "Build Perf Test Report for $os_name" --text $report_txt --html $report_html "${OE_BUILD_PERF_REPORT_EMAIL_EXTRA_ARGS[@]}"
|
||||
"$script_dir"/oe-build-perf-report-email.py --to "$email_to" --subject "Build Perf Test Report for $os_name" --text $report_txt "${OE_BUILD_PERF_REPORT_EMAIL_EXTRA_ARGS[@]}"
|
||||
fi
|
||||
|
||||
# Upload report files, unless we're on detached head
|
||||
|
||||
@@ -19,8 +19,6 @@ import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from email.mime.image import MIMEImage
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
|
||||
@@ -29,30 +27,6 @@ logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
|
||||
log = logging.getLogger('oe-build-perf-report')
|
||||
|
||||
|
||||
# Find js scaper script
|
||||
SCRAPE_JS = os.path.join(os.path.dirname(__file__), '..', 'lib', 'build_perf',
|
||||
'scrape-html-report.js')
|
||||
if not os.path.isfile(SCRAPE_JS):
|
||||
log.error("Unableto find oe-build-perf-report-scrape.js")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
class ReportError(Exception):
|
||||
"""Local errors"""
|
||||
pass
|
||||
|
||||
|
||||
def check_utils():
|
||||
"""Check that all needed utils are installed in the system"""
|
||||
missing = []
|
||||
for cmd in ('phantomjs', 'optipng'):
|
||||
if not shutil.which(cmd):
|
||||
missing.append(cmd)
|
||||
if missing:
|
||||
log.error("The following tools are missing: %s", ' '.join(missing))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def parse_args(argv):
|
||||
"""Parse command line arguments"""
|
||||
description = """Email build perf test report"""
|
||||
@@ -77,137 +51,19 @@ def parse_args(argv):
|
||||
"the email parts")
|
||||
parser.add_argument('--text',
|
||||
help="Plain text message")
|
||||
parser.add_argument('--html',
|
||||
help="HTML peport generated by oe-build-perf-report")
|
||||
parser.add_argument('--phantomjs-args', action='append',
|
||||
help="Extra command line arguments passed to PhantomJS")
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
if not args.html and not args.text:
|
||||
parser.error("Please specify --html and/or --text")
|
||||
if not args.text:
|
||||
parser.error("Please specify --text")
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def decode_png(infile, outfile):
|
||||
"""Parse/decode/optimize png data from a html element"""
|
||||
with open(infile) as f:
|
||||
raw_data = f.read()
|
||||
|
||||
# Grab raw base64 data
|
||||
b64_data = re.sub('^.*href="data:image/png;base64,', '', raw_data, 1)
|
||||
b64_data = re.sub('">.+$', '', b64_data, 1)
|
||||
|
||||
# Replace file with proper decoded png
|
||||
with open(outfile, 'wb') as f:
|
||||
f.write(base64.b64decode(b64_data))
|
||||
|
||||
subprocess.check_output(['optipng', outfile], stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
def mangle_html_report(infile, outfile, pngs):
|
||||
"""Mangle html file into a email compatible format"""
|
||||
paste = True
|
||||
png_dir = os.path.dirname(outfile)
|
||||
with open(infile) as f_in:
|
||||
with open(outfile, 'w') as f_out:
|
||||
for line in f_in.readlines():
|
||||
stripped = line.strip()
|
||||
# Strip out scripts
|
||||
if stripped == '<!--START-OF-SCRIPTS-->':
|
||||
paste = False
|
||||
elif stripped == '<!--END-OF-SCRIPTS-->':
|
||||
paste = True
|
||||
elif paste:
|
||||
if re.match('^.+href="data:image/png;base64', stripped):
|
||||
# Strip out encoded pngs (as they're huge in size)
|
||||
continue
|
||||
elif 'www.gstatic.com' in stripped:
|
||||
# HACK: drop references to external static pages
|
||||
continue
|
||||
|
||||
# Replace charts with <img> elements
|
||||
match = re.match('<div id="(?P<id>\w+)"', stripped)
|
||||
if match and match.group('id') in pngs:
|
||||
f_out.write('<img src="cid:{}"\n'.format(match.group('id')))
|
||||
else:
|
||||
f_out.write(line)
|
||||
|
||||
|
||||
def scrape_html_report(report, outdir, phantomjs_extra_args=None):
|
||||
"""Scrape html report into a format sendable by email"""
|
||||
tmpdir = tempfile.mkdtemp(dir='.')
|
||||
log.debug("Using tmpdir %s for phantomjs output", tmpdir)
|
||||
|
||||
if not os.path.isdir(outdir):
|
||||
os.mkdir(outdir)
|
||||
if os.path.splitext(report)[1] not in ('.html', '.htm'):
|
||||
raise ReportError("Invalid file extension for report, needs to be "
|
||||
"'.html' or '.htm'")
|
||||
|
||||
try:
|
||||
log.info("Scraping HTML report with PhangomJS")
|
||||
extra_args = phantomjs_extra_args if phantomjs_extra_args else []
|
||||
subprocess.check_output(['phantomjs', '--debug=true'] + extra_args +
|
||||
[SCRAPE_JS, report, tmpdir],
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
pngs = []
|
||||
images = []
|
||||
for fname in os.listdir(tmpdir):
|
||||
base, ext = os.path.splitext(fname)
|
||||
if ext == '.png':
|
||||
log.debug("Decoding %s", fname)
|
||||
decode_png(os.path.join(tmpdir, fname),
|
||||
os.path.join(outdir, fname))
|
||||
pngs.append(base)
|
||||
images.append(fname)
|
||||
elif ext in ('.html', '.htm'):
|
||||
report_file = fname
|
||||
else:
|
||||
log.warning("Unknown file extension: '%s'", ext)
|
||||
#shutil.move(os.path.join(tmpdir, fname), outdir)
|
||||
|
||||
log.debug("Mangling html report file %s", report_file)
|
||||
mangle_html_report(os.path.join(tmpdir, report_file),
|
||||
os.path.join(outdir, report_file), pngs)
|
||||
return (os.path.join(outdir, report_file),
|
||||
[os.path.join(outdir, i) for i in images])
|
||||
finally:
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
def send_email(text_fn, html_fn, image_fns, subject, recipients, copy=[],
|
||||
blind_copy=[]):
|
||||
"""Send email"""
|
||||
def send_email(text_fn, subject, recipients, copy=[], blind_copy=[]):
|
||||
# Generate email message
|
||||
text_msg = html_msg = None
|
||||
if text_fn:
|
||||
with open(text_fn) as f:
|
||||
text_msg = MIMEText("Yocto build performance test report.\n" +
|
||||
f.read(), 'plain')
|
||||
if html_fn:
|
||||
html_msg = msg = MIMEMultipart('related')
|
||||
with open(html_fn) as f:
|
||||
html_msg.attach(MIMEText(f.read(), 'html'))
|
||||
for img_fn in image_fns:
|
||||
# Expect that content id is same as the filename
|
||||
cid = os.path.splitext(os.path.basename(img_fn))[0]
|
||||
with open(img_fn, 'rb') as f:
|
||||
image_msg = MIMEImage(f.read())
|
||||
image_msg['Content-ID'] = '<{}>'.format(cid)
|
||||
html_msg.attach(image_msg)
|
||||
|
||||
if text_msg and html_msg:
|
||||
msg = MIMEMultipart('alternative')
|
||||
msg.attach(text_msg)
|
||||
msg.attach(html_msg)
|
||||
elif text_msg:
|
||||
msg = text_msg
|
||||
elif html_msg:
|
||||
msg = html_msg
|
||||
else:
|
||||
raise ReportError("Neither plain text nor html body specified")
|
||||
with open(text_fn) as f:
|
||||
msg = MIMEText("Yocto build performance test report.\n" + f.read(), 'plain')
|
||||
|
||||
pw_data = pwd.getpwuid(os.getuid())
|
||||
full_name = pw_data.pw_gecos.split(',')[0]
|
||||
@@ -234,8 +90,6 @@ def main(argv=None):
|
||||
if args.debug:
|
||||
log.setLevel(logging.DEBUG)
|
||||
|
||||
check_utils()
|
||||
|
||||
if args.outdir:
|
||||
outdir = args.outdir
|
||||
if not os.path.exists(outdir):
|
||||
@@ -245,25 +99,16 @@ def main(argv=None):
|
||||
|
||||
try:
|
||||
log.debug("Storing email parts in %s", outdir)
|
||||
html_report = images = None
|
||||
if args.html:
|
||||
html_report, images = scrape_html_report(args.html, outdir,
|
||||
args.phantomjs_args)
|
||||
|
||||
if args.to:
|
||||
log.info("Sending email to %s", ', '.join(args.to))
|
||||
if args.cc:
|
||||
log.info("Copying to %s", ', '.join(args.cc))
|
||||
if args.bcc:
|
||||
log.info("Blind copying to %s", ', '.join(args.bcc))
|
||||
send_email(args.text, html_report, images, args.subject,
|
||||
args.to, args.cc, args.bcc)
|
||||
send_email(args.text, args.subject, args.to, args.cc, args.bcc)
|
||||
except subprocess.CalledProcessError as err:
|
||||
log.error("%s, with output:\n%s", str(err), err.output.decode())
|
||||
return 1
|
||||
except ReportError as err:
|
||||
log.error(err)
|
||||
return 1
|
||||
finally:
|
||||
if not args.outdir:
|
||||
log.debug("Wiping %s", outdir)
|
||||
|
||||
26
scripts/git
Executable file
26
scripts/git
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Wrapper around 'git' that doesn't think we are root
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
os.environ['PSEUDO_UNLOAD'] = '1'
|
||||
|
||||
# calculate path to the real 'git'
|
||||
path = os.environ['PATH']
|
||||
# we need to remove our path but also any other copy of this script which
|
||||
# may be present, e.g. eSDK.
|
||||
replacements = [os.path.dirname(sys.argv[0])]
|
||||
for p in path.split(":"):
|
||||
if p.endswith("/scripts"):
|
||||
replacements.append(p)
|
||||
for r in replacements:
|
||||
path = path.replace(r, '/ignoreme')
|
||||
real_git = shutil.which('git', path=path)
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
os.execl(real_git, 'git')
|
||||
|
||||
os.execv(real_git, sys.argv)
|
||||
Reference in New Issue
Block a user