mirror of
https://git.yoctoproject.org/poky
synced 2026-02-22 17:39:39 +01:00
Compare commits
61 Commits
dunfell-23
...
yocto-3.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11f05ffddd | ||
|
|
9fbfbf002e | ||
|
|
6b2a22bc7b | ||
|
|
10108d0ebf | ||
|
|
ba90fb0f3d | ||
|
|
1982d0cc7c | ||
|
|
3acc83f91a | ||
|
|
2a1cf26ba4 | ||
|
|
9ab9e48d36 | ||
|
|
a2147d6d27 | ||
|
|
e2b5de2c77 | ||
|
|
144748fed8 | ||
|
|
507f16e1bc | ||
|
|
e0059335fb | ||
|
|
75022804d8 | ||
|
|
818ad186ae | ||
|
|
1904daa987 | ||
|
|
c86b92df02 | ||
|
|
76b5620df7 | ||
|
|
d47b9fe7c8 | ||
|
|
4c78aab891 | ||
|
|
d20a4df83b | ||
|
|
139406c025 | ||
|
|
1231009682 | ||
|
|
aa673e1427 | ||
|
|
770bb4a64a | ||
|
|
d7fa5a35aa | ||
|
|
7b9f7437ed | ||
|
|
c35692c6eb | ||
|
|
9fa2eba749 | ||
|
|
f1dbb005c8 | ||
|
|
1a96c7537f | ||
|
|
7618011039 | ||
|
|
b4802e2fdb | ||
|
|
0d3339a23a | ||
|
|
3d32267b52 | ||
|
|
9d8cb501f7 | ||
|
|
59bfcd7299 | ||
|
|
c3fb76fc72 | ||
|
|
b4675ad33f | ||
|
|
3f4da8c618 | ||
|
|
358c909fc7 | ||
|
|
1d3f2be1e6 | ||
|
|
e22da98e79 | ||
|
|
580df9b4c4 | ||
|
|
50108e2180 | ||
|
|
3c3039aac4 | ||
|
|
4853705635 | ||
|
|
c58bdcd15c | ||
|
|
ba201fc313 | ||
|
|
d160225d21 | ||
|
|
86e2430d3f | ||
|
|
bf604a8fa8 | ||
|
|
f6899f9b94 | ||
|
|
3c76d0ad71 | ||
|
|
826011d497 | ||
|
|
0922cef2f4 | ||
|
|
e5414e5962 | ||
|
|
17aad7feac | ||
|
|
b200c2d16e | ||
|
|
eb79d76099 |
@@ -13,7 +13,6 @@ import sys, os, glob, os.path, re, time
|
||||
import itertools
|
||||
import logging
|
||||
import multiprocessing
|
||||
import sre_constants
|
||||
import threading
|
||||
from io import StringIO, UnsupportedOperation
|
||||
from contextlib import closing
|
||||
@@ -1795,7 +1794,7 @@ class CookerCollectFiles(object):
|
||||
try:
|
||||
re.compile(mask)
|
||||
bbmasks.append(mask)
|
||||
except sre_constants.error:
|
||||
except re.error:
|
||||
collectlog.critical("BBMASK contains an invalid regular expression, ignoring: %s" % mask)
|
||||
|
||||
# Then validate the combined regular expressions. This should never
|
||||
@@ -1803,7 +1802,7 @@ class CookerCollectFiles(object):
|
||||
bbmask = "|".join(bbmasks)
|
||||
try:
|
||||
bbmask_compiled = re.compile(bbmask)
|
||||
except sre_constants.error:
|
||||
except re.error:
|
||||
collectlog.critical("BBMASK is not a valid regular expression, ignoring: %s" % bbmask)
|
||||
bbmask = None
|
||||
|
||||
|
||||
@@ -1975,6 +1975,12 @@ class RunQueueExecute:
|
||||
self.setbuildable(revdep)
|
||||
logger.debug(1, "Marking task %s as buildable", revdep)
|
||||
|
||||
for t in self.sq_deferred.copy():
|
||||
if self.sq_deferred[t] == task:
|
||||
logger.debug(2, "Deferred task %s now buildable" % t)
|
||||
del self.sq_deferred[t]
|
||||
update_scenequeue_data([t], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
|
||||
|
||||
def task_complete(self, task):
|
||||
self.stats.taskCompleted()
|
||||
bb.event.fire(runQueueTaskCompleted(task, self.stats, self.rq), self.cfgData)
|
||||
@@ -2084,8 +2090,6 @@ class RunQueueExecute:
|
||||
logger.debug(1, "%s didn't become valid, skipping setscene" % nexttask)
|
||||
self.sq_task_failoutright(nexttask)
|
||||
return True
|
||||
else:
|
||||
self.sqdata.outrightfail.remove(nexttask)
|
||||
if nexttask in self.sqdata.outrightfail:
|
||||
logger.debug(2, 'No package found, so skipping setscene task %s', nexttask)
|
||||
self.sq_task_failoutright(nexttask)
|
||||
@@ -2236,7 +2240,8 @@ class RunQueueExecute:
|
||||
if self.sq_deferred:
|
||||
tid = self.sq_deferred.pop(list(self.sq_deferred.keys())[0])
|
||||
logger.warning("Runqeueue deadlocked on deferred tasks, forcing task %s" % tid)
|
||||
self.sq_task_failoutright(tid)
|
||||
if tid not in self.runq_complete:
|
||||
self.sq_task_failoutright(tid)
|
||||
return True
|
||||
|
||||
if len(self.failed_tids) != 0:
|
||||
@@ -2350,10 +2355,16 @@ class RunQueueExecute:
|
||||
self.updated_taskhash_queue.remove((tid, unihash))
|
||||
|
||||
if unihash != self.rqdata.runtaskentries[tid].unihash:
|
||||
hashequiv_logger.verbose("Task %s unihash changed to %s" % (tid, unihash))
|
||||
self.rqdata.runtaskentries[tid].unihash = unihash
|
||||
bb.parse.siggen.set_unihash(tid, unihash)
|
||||
toprocess.add(tid)
|
||||
# Make sure we rehash any other tasks with the same task hash that we're deferred against.
|
||||
torehash = [tid]
|
||||
for deftid in self.sq_deferred:
|
||||
if self.sq_deferred[deftid] == tid:
|
||||
torehash.append(deftid)
|
||||
for hashtid in torehash:
|
||||
hashequiv_logger.verbose("Task %s unihash changed to %s" % (hashtid, unihash))
|
||||
self.rqdata.runtaskentries[hashtid].unihash = unihash
|
||||
bb.parse.siggen.set_unihash(hashtid, unihash)
|
||||
toprocess.add(hashtid)
|
||||
|
||||
# Work out all tasks which depend upon these
|
||||
total = set()
|
||||
@@ -2492,6 +2503,14 @@ class RunQueueExecute:
|
||||
|
||||
if update_tasks:
|
||||
self.sqdone = False
|
||||
for mc in sorted(self.sqdata.multiconfigs):
|
||||
for tid in sorted([t[0] for t in update_tasks]):
|
||||
if mc_from_tid(tid) != mc:
|
||||
continue
|
||||
h = pending_hash_index(tid, self.rqdata)
|
||||
if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]:
|
||||
self.sq_deferred[tid] = self.sqdata.hashes[h]
|
||||
bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h]))
|
||||
update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
|
||||
|
||||
for (tid, harddepfail, origvalid) in update_tasks:
|
||||
@@ -2832,6 +2851,19 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
|
||||
sqdata.stamppresent = set()
|
||||
sqdata.valid = set()
|
||||
|
||||
sqdata.hashes = {}
|
||||
sqrq.sq_deferred = {}
|
||||
for mc in sorted(sqdata.multiconfigs):
|
||||
for tid in sorted(sqdata.sq_revdeps):
|
||||
if mc_from_tid(tid) != mc:
|
||||
continue
|
||||
h = pending_hash_index(tid, rqdata)
|
||||
if h not in sqdata.hashes:
|
||||
sqdata.hashes[h] = tid
|
||||
else:
|
||||
sqrq.sq_deferred[tid] = sqdata.hashes[h]
|
||||
bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
|
||||
|
||||
update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True)
|
||||
|
||||
def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True):
|
||||
@@ -2843,6 +2875,8 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
|
||||
sqdata.stamppresent.remove(tid)
|
||||
if tid in sqdata.valid:
|
||||
sqdata.valid.remove(tid)
|
||||
if tid in sqdata.outrightfail:
|
||||
sqdata.outrightfail.remove(tid)
|
||||
|
||||
(mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
|
||||
|
||||
@@ -2870,32 +2904,20 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
|
||||
|
||||
sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
|
||||
|
||||
sqdata.hashes = {}
|
||||
sqrq.sq_deferred = {}
|
||||
for mc in sorted(sqdata.multiconfigs):
|
||||
for tid in sorted(sqdata.sq_revdeps):
|
||||
if mc_from_tid(tid) != mc:
|
||||
continue
|
||||
if tid in sqdata.stamppresent:
|
||||
continue
|
||||
if tid in sqdata.valid:
|
||||
continue
|
||||
if tid in sqdata.noexec:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_notcovered:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_covered:
|
||||
continue
|
||||
|
||||
sqdata.outrightfail.add(tid)
|
||||
|
||||
h = pending_hash_index(tid, rqdata)
|
||||
if h not in sqdata.hashes:
|
||||
sqdata.hashes[h] = tid
|
||||
else:
|
||||
sqrq.sq_deferred[tid] = sqdata.hashes[h]
|
||||
bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
|
||||
|
||||
for tid in tids:
|
||||
if tid in sqdata.stamppresent:
|
||||
continue
|
||||
if tid in sqdata.valid:
|
||||
continue
|
||||
if tid in sqdata.noexec:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_covered:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_notcovered:
|
||||
continue
|
||||
if tid in sqrq.sq_deferred:
|
||||
continue
|
||||
sqdata.outrightfail.add(tid)
|
||||
|
||||
class TaskFailure(Exception):
|
||||
"""
|
||||
|
||||
@@ -97,6 +97,7 @@ extlinks = {
|
||||
'yocto_git': ('https://git.yoctoproject.org%s', None),
|
||||
'oe_home': ('https://www.openembedded.org%s', None),
|
||||
'oe_lists': ('https://lists.openembedded.org%s', None),
|
||||
'oe_git': ('https://git.openembedded.org%s', None),
|
||||
}
|
||||
|
||||
# Intersphinx config to use cross reference with Bitbake user manual
|
||||
|
||||
@@ -377,7 +377,7 @@ activities using the Yocto Project:
|
||||
Index <http://layers.openembedded.org/layerindex/layers/>`__, which
|
||||
is a website that indexes OpenEmbedded-Core layers.
|
||||
|
||||
- *Patchwork:* `Patchwork <http://jk.ozlabs.org/projects/patchwork/>`__
|
||||
- *Patchwork:* `Patchwork <https://patchwork.yoctoproject.org/>`__
|
||||
is a fork of a project originally started by
|
||||
`OzLabs <http://ozlabs.org/>`__. The project is a web-based tracking
|
||||
system designed to streamline the process of bringing contributions
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.23"
|
||||
DISTRO : "3.1.24"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.23"
|
||||
YOCTO_DOC_VERSION : "3.1.24"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.23"
|
||||
DOCCONF_VERSION : "3.1.23"
|
||||
DISTRO_REL_TAG : "yocto-3.1.24"
|
||||
DOCCONF_VERSION : "3.1.24"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.23"
|
||||
POKYVERSION : "23.0.24"
|
||||
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
|
||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||
|
||||
@@ -1734,7 +1734,7 @@ events':
|
||||
|
||||
The tool is pretty self-explanatory, but for more detailed information
|
||||
on navigating through the data, see the `kernelshark
|
||||
website <http://rostedt.homelinux.com/kernelshark/>`__.
|
||||
website <https://kernelshark.org/Documentation.html>`__.
|
||||
|
||||
.. _ftrace-documentation:
|
||||
|
||||
@@ -1765,8 +1765,8 @@ There is a nice series of articles on using ftrace and trace-cmd at LWN:
|
||||
- `trace-cmd: A front-end for
|
||||
Ftrace <https://lwn.net/Articles/410200/>`__
|
||||
|
||||
There's more detailed documentation kernelshark usage here:
|
||||
`KernelShark <http://rostedt.homelinux.com/kernelshark/>`__
|
||||
See also `KernelShark's documentation <https://kernelshark.org/Documentation.html>`__
|
||||
for further usage details.
|
||||
|
||||
An amusing yet useful README (a tracing mini-HOWTO) can be found in
|
||||
``/sys/kernel/debug/tracing/README``.
|
||||
|
||||
@@ -45,6 +45,8 @@ distributions:
|
||||
|
||||
- Ubuntu 20.04
|
||||
|
||||
- Ubuntu 22.04
|
||||
|
||||
- Fedora 28
|
||||
|
||||
- Fedora 29
|
||||
@@ -61,6 +63,8 @@ distributions:
|
||||
|
||||
- Fedora 35
|
||||
|
||||
- Fedora 36
|
||||
|
||||
- CentOS 7.x
|
||||
|
||||
- Debian GNU/Linux 8.x (Jessie)
|
||||
@@ -79,6 +83,8 @@ distributions:
|
||||
|
||||
- AlmaLinux 8.5
|
||||
|
||||
- AlmaLinux 8.7
|
||||
|
||||
.. note::
|
||||
|
||||
- While the Yocto Project Team attempts to ensure all Yocto Project
|
||||
|
||||
@@ -7147,6 +7147,32 @@ system and gives an overview of their function and contents.
|
||||
:term:`SSTATE_DIR`
|
||||
The directory for the shared state cache.
|
||||
|
||||
:term:`SSTATE_EXCLUDEDEPS_SYSROOT`
|
||||
This variable allows to specify indirect dependencies to exclude
|
||||
from sysroots, for example to avoid the situations when a dependency on
|
||||
any ``-native`` recipe will pull in all dependencies of that recipe
|
||||
in the recipe sysroot. This behaviour might not always be wanted,
|
||||
for example when that ``-native`` recipe depends on build tools
|
||||
that are not relevant for the current recipe.
|
||||
|
||||
This way, irrelevant dependencies are ignored, which could have
|
||||
prevented the reuse of prebuilt artifacts stored in the Shared
|
||||
State Cache.
|
||||
|
||||
:term:`SSTATE_EXCLUDEDEPS_SYSROOT` is evaluated as two regular
|
||||
expressions of recipe and dependency to ignore. An example
|
||||
is the rule in :oe_git:`meta/conf/layer.conf </openembedded-core/tree/meta/conf/layer.conf>`::
|
||||
|
||||
# Nothing needs to depend on libc-initial
|
||||
# base-passwd/shadow-sysroot don't need their dependencies
|
||||
SSTATE_EXCLUDEDEPS_SYSROOT += "\
|
||||
.*->.*-initial.* \
|
||||
.*(base-passwd|shadow-sysroot)->.* \
|
||||
"
|
||||
|
||||
The ``->`` substring represents the dependency between
|
||||
the two regular expressions.
|
||||
|
||||
:term:`SSTATE_MIRROR_ALLOW_NETWORK`
|
||||
If set to "1", allows fetches from mirrors that are specified in
|
||||
:term:`SSTATE_MIRRORS` to work even when
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "3.1.23"
|
||||
DISTRO_VERSION = "3.1.24"
|
||||
DISTRO_CODENAME = "dunfell"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
@@ -47,12 +47,14 @@ SANITY_TESTED_DISTROS ?= " \
|
||||
ubuntu-18.04 \n \
|
||||
ubuntu-19.04 \n \
|
||||
ubuntu-20.04 \n \
|
||||
ubuntu-22.04 \n \
|
||||
fedora-30 \n \
|
||||
fedora-31 \n \
|
||||
fedora-32 \n \
|
||||
fedora-33 \n \
|
||||
fedora-34 \n \
|
||||
fedora-35 \n \
|
||||
fedora-36 \n \
|
||||
centos-7 \n \
|
||||
centos-8 \n \
|
||||
debian-8 \n \
|
||||
@@ -63,6 +65,7 @@ SANITY_TESTED_DISTROS ?= " \
|
||||
opensuseleap-15.2 \n \
|
||||
opensuseleap-15.3 \n \
|
||||
almalinux-8.5 \n \
|
||||
almalinux-8.7 \n \
|
||||
"
|
||||
# add poky sanity bbclass
|
||||
INHERIT += "poky-sanity"
|
||||
|
||||
@@ -2,8 +2,6 @@ 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 ")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
def get_rootfs_uuid(d):
|
||||
import subprocess
|
||||
rootfs = d.getVar('ROOTFS')
|
||||
output = subprocess.check_output(['tune2fs', '-l', rootfs])
|
||||
output = subprocess.check_output(['tune2fs', '-l', rootfs], text=True)
|
||||
for line in output.split('\n'):
|
||||
if line.startswith('Filesystem UUID:'):
|
||||
uuid = line.split()[-1]
|
||||
|
||||
@@ -311,7 +311,7 @@ fakeroot python do_image_qa () {
|
||||
except oe.utils.ImageQAFailed as e:
|
||||
qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
|
||||
except Exception as e:
|
||||
qamsg = qamsg + '\tImage QA function %s failed\n' % cmd
|
||||
qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (cmd, e)
|
||||
|
||||
if qamsg:
|
||||
imgname = d.getVar('IMAGE_NAME')
|
||||
@@ -437,7 +437,7 @@ python () {
|
||||
localdata.delVar('DATETIME')
|
||||
localdata.delVar('DATE')
|
||||
localdata.delVar('TMPDIR')
|
||||
vardepsexclude = (d.getVarFlag('IMAGE_CMD_' + realt, 'vardepsexclude', True) or '').split()
|
||||
vardepsexclude = (d.getVarFlag('IMAGE_CMD_' + realt, 'vardepsexclude') or '').split()
|
||||
for dep in vardepsexclude:
|
||||
localdata.delVar(dep)
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ do_kernel_metadata() {
|
||||
# SRC_URI. If they were supplied, we convert them into include directives
|
||||
# for the update part of the process
|
||||
for f in ${feat_dirs}; do
|
||||
if [ -d "${WORKDIR}/$f/meta" ]; then
|
||||
if [ -d "${WORKDIR}/$f/kernel-meta" ]; then
|
||||
includes="$includes -I${WORKDIR}/$f/kernel-meta"
|
||||
elif [ -d "${WORKDIR}/../oe-local-files/$f" ]; then
|
||||
includes="$includes -I${WORKDIR}/../oe-local-files/$f"
|
||||
|
||||
@@ -595,7 +595,7 @@ do_savedefconfig() {
|
||||
do_savedefconfig[nostamp] = "1"
|
||||
addtask savedefconfig after do_configure
|
||||
|
||||
inherit cml1
|
||||
inherit cml1 pkgconfig
|
||||
|
||||
KCONFIG_CONFIG_COMMAND_append = " LD='${KERNEL_LD}' HOSTLDFLAGS='${BUILD_LDFLAGS}'"
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ PACKAGE_NO_GCONV ?= "0"
|
||||
OVERRIDES_append = ":${TARGET_ARCH}-${TARGET_OS}"
|
||||
|
||||
locale_base_postinst_ontarget() {
|
||||
mkdir ${libdir}/locale
|
||||
localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s %s
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ def get_deployed_dependencies(d):
|
||||
deploy = {}
|
||||
# Get all the dependencies for the current task (rootfs).
|
||||
taskdata = d.getVar("BB_TASKDEPDATA", False)
|
||||
pn = d.getVar("PN", True)
|
||||
pn = d.getVar("PN")
|
||||
depends = list(set([dep[0] for dep
|
||||
in list(taskdata.values())
|
||||
if not dep[0].endswith("-native") and not dep[0] == pn]))
|
||||
|
||||
@@ -113,3 +113,5 @@ do_packagedata[stamp-extra-info] = ""
|
||||
USE_NLS = "${SDKUSE_NLS}"
|
||||
|
||||
OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}"
|
||||
|
||||
PATH_prepend = "${COREBASE}/scripts/nativesdk-intercept:"
|
||||
|
||||
@@ -67,11 +67,11 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
|
||||
% self.default_target_type)
|
||||
runtime_group.add_argument('--target-ip', action='store',
|
||||
default=self.default_target_ip,
|
||||
help="IP address of device under test, default: %s" \
|
||||
help="IP address and optionally ssh port (default 22) of device under test, for example '192.168.0.7:22'. Default: %s" \
|
||||
% self.default_target_ip)
|
||||
runtime_group.add_argument('--server-ip', action='store',
|
||||
default=self.default_target_ip,
|
||||
help="IP address of device under test, default: %s" \
|
||||
help="IP address of the test host from test target machine, default: %s" \
|
||||
% self.default_server_ip)
|
||||
|
||||
runtime_group.add_argument('--host-dumper-dir', action='store',
|
||||
|
||||
@@ -75,7 +75,7 @@ class BitbakePrTests(OESelftestTestCase):
|
||||
exported_db_path = os.path.join(self.builddir, 'export.inc')
|
||||
export_result = runCmd("bitbake-prserv-tool export %s" % exported_db_path, ignore_status=True)
|
||||
self.assertEqual(export_result.status, 0, msg="PR Service database export failed: %s" % export_result.output)
|
||||
self.assertTrue(os.path.exists(exported_db_path))
|
||||
self.assertTrue(os.path.exists(exported_db_path), msg="%s didn't exist, tool output %s" % (exported_db_path, export_result.output))
|
||||
|
||||
if replace_current_db:
|
||||
current_db_path = os.path.join(get_bb_var('PERSISTENT_DIR'), 'prserv.sqlite3')
|
||||
|
||||
@@ -39,7 +39,6 @@ exclude_packages = [
|
||||
'gstreamer1.0-python',
|
||||
'hwlatdetect',
|
||||
'kernel-devsrc',
|
||||
'libaprutil',
|
||||
'libcap-ng',
|
||||
'libjson',
|
||||
'libproxy',
|
||||
|
||||
@@ -432,10 +432,13 @@ class QemuRunner:
|
||||
except OSError as e:
|
||||
if e.errno != errno.ESRCH:
|
||||
raise
|
||||
endtime = time.time() + self.runqemutime
|
||||
while self.runqemu.poll() is None and time.time() < endtime:
|
||||
time.sleep(1)
|
||||
if self.runqemu.poll() is None:
|
||||
try:
|
||||
outs, errs = self.runqemu.communicate(timeout = self.runqemutime)
|
||||
if outs:
|
||||
self.logger.info("Output from runqemu:\n%s", outs.decode("utf-8"))
|
||||
if errs:
|
||||
self.logger.info("Stderr from runqemu:\n%s", errs.decode("utf-8"))
|
||||
except TimeoutExpired:
|
||||
self.logger.debug("Sending SIGKILL to runqemu")
|
||||
os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL)
|
||||
if not self.runqemu.stdout.closed:
|
||||
|
||||
@@ -6,6 +6,13 @@ SRC_URI[sha256sum] = "8863717113c4897e2ad3271fc808ea245319e6fd95eed2e934fae8e089
|
||||
# These issues have kernel fixes rather than bluez fixes so exclude here
|
||||
CVE_CHECK_WHITELIST += "CVE-2020-12352 CVE-2020-24490"
|
||||
|
||||
# Commit 7a80d2096f1b7125085e21448112aa02f49f5e9a, e2b0f0d8d63e1223bb714a9efb37e2257818268b
|
||||
# and 0388794dc5fdb73a4ea88bcf148de0a12b4364d4 to fix CVE-2022-39177
|
||||
# already backport in CVE-2022-39176.patch
|
||||
# https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/1977968
|
||||
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-39177"
|
||||
|
||||
# noinst programs in Makefile.tools that are conditional on READLINE
|
||||
# support
|
||||
NOINST_TOOLS_READLINE ?= " \
|
||||
|
||||
@@ -24,7 +24,7 @@ SRC_URI_append_class-nativesdk = " \
|
||||
file://environment.d-openssl.sh \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa"
|
||||
SRC_URI[sha256sum] = "8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b"
|
||||
|
||||
inherit lib_package multilib_header multilib_script ptest
|
||||
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
|
||||
@@ -139,6 +139,10 @@ do_configure () {
|
||||
do_prepare_config
|
||||
merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
|
||||
cml1_do_configure
|
||||
|
||||
# Save a copy of .config and autoconf.h.
|
||||
cp .config .config.orig
|
||||
cp include/autoconf.h include/autoconf.h.orig
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
@@ -146,13 +150,17 @@ do_compile() {
|
||||
if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
|
||||
export KCONFIG_NOTIMESTAMP=1
|
||||
fi
|
||||
|
||||
# Ensure we start do_compile with the original .config and autoconf.h.
|
||||
# These files should always have matching timestamps.
|
||||
cp .config.orig .config
|
||||
cp include/autoconf.h.orig include/autoconf.h
|
||||
|
||||
if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
|
||||
# Guard againt interrupted do_compile: clean temporary files.
|
||||
rm -f .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
|
||||
# split the .config into two parts, and make two busybox binaries
|
||||
if [ -e .config.orig ]; then
|
||||
# Need to guard again an interrupted do_compile - restore any backup
|
||||
cp .config.orig .config
|
||||
fi
|
||||
cp .config .config.orig
|
||||
oe_runmake busybox.cfg.suid
|
||||
oe_runmake busybox.cfg.nosuid
|
||||
|
||||
@@ -189,15 +197,18 @@ do_compile() {
|
||||
bbfatal "busybox suid binary incorrectly provides /bin/sh"
|
||||
fi
|
||||
|
||||
# copy .config.orig back to .config, because the install process may check this file
|
||||
cp .config.orig .config
|
||||
# cleanup
|
||||
rm .config.orig .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
rm .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
else
|
||||
oe_runmake busybox_unstripped
|
||||
cp busybox_unstripped busybox
|
||||
oe_runmake busybox.links
|
||||
fi
|
||||
|
||||
# restore original .config and autoconf.h, because the install process
|
||||
# may check these files
|
||||
cp .config.orig .config
|
||||
cp include/autoconf.h.orig include/autoconf.h
|
||||
}
|
||||
|
||||
do_install () {
|
||||
|
||||
82
meta/recipes-core/glibc/glibc/CVE-2023-0687.patch
Normal file
82
meta/recipes-core/glibc/glibc/CVE-2023-0687.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
From 952aff5c00ad7c6b83c3f310f2643939538827f8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?=
|
||||
=?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= <leo@yuriev.ru>
|
||||
Date: Sat, 4 Feb 2023 14:41:38 +0300
|
||||
Subject: [PATCH] gmon: Fix allocated buffer overflow (bug 29444)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The `__monstartup()` allocates a buffer used to store all the data
|
||||
accumulated by the monitor.
|
||||
|
||||
The size of this buffer depends on the size of the internal structures
|
||||
used and the address range for which the monitor is activated, as well
|
||||
as on the maximum density of call instructions and/or callable functions
|
||||
that could be potentially on a segment of executable code.
|
||||
|
||||
In particular a hash table of arcs is placed at the end of this buffer.
|
||||
The size of this hash table is calculated in bytes as
|
||||
p->fromssize = p->textsize / HASHFRACTION;
|
||||
|
||||
but actually should be
|
||||
p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
|
||||
This results in writing beyond the end of the allocated buffer when an
|
||||
added arc corresponds to a call near from the end of the monitored
|
||||
address range, since `_mcount()` check the incoming caller address for
|
||||
monitored range but not the intermediate result hash-like index that
|
||||
uses to write into the table.
|
||||
|
||||
It should be noted that when the results are output to `gmon.out`, the
|
||||
table is read to the last element calculated from the allocated size in
|
||||
bytes, so the arcs stored outside the buffer boundary did not fall into
|
||||
`gprof` for analysis. Thus this "feature" help me to found this bug
|
||||
during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438
|
||||
|
||||
Just in case, I will explicitly note that the problem breaks the
|
||||
`make test t=gmon/tst-gmon-dso` added for Bug 29438.
|
||||
There, the arc of the `f3()` call disappears from the output, since in
|
||||
the DSO case, the call to `f3` is located close to the end of the
|
||||
monitored range.
|
||||
|
||||
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
|
||||
|
||||
Another minor error seems a related typo in the calculation of
|
||||
`kcountsize`, but since kcounts are smaller than froms, this is
|
||||
actually to align the p->froms data.
|
||||
|
||||
Co-authored-by: DJ Delorie <dj@redhat.com>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=801af9fafd4689337ebf27260aa115335a0cb2bc]
|
||||
CVE: CVE-2023-0687
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
gmon/gmon.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gmon/gmon.c b/gmon/gmon.c
|
||||
index dee6480..bf76358 100644
|
||||
--- a/gmon/gmon.c
|
||||
+++ b/gmon/gmon.c
|
||||
@@ -132,6 +132,8 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->textsize = p->highpc - p->lowpc;
|
||||
+ /* This looks like a typo, but it's here to align the p->froms
|
||||
+ section. */
|
||||
p->kcountsize = ROUNDUP(p->textsize / HISTFRACTION, sizeof(*p->froms));
|
||||
p->hashfraction = HASHFRACTION;
|
||||
p->log_hashfraction = -1;
|
||||
@@ -142,7 +144,7 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
instead of integer division. Precompute shift amount. */
|
||||
p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
|
||||
}
|
||||
- p->fromssize = p->textsize / HASHFRACTION;
|
||||
+ p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
p->tolimit = p->textsize * ARCDENSITY / 100;
|
||||
if (p->tolimit < MINARCS)
|
||||
p->tolimit = MINARCS;
|
||||
--
|
||||
2.7.4
|
||||
@@ -79,6 +79,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
|
||||
file://0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \
|
||||
file://0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \
|
||||
file://0037-Avoid-deadlock-between-pthread_create-and-ctors.patch \
|
||||
file://CVE-2023-0687.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
B = "${WORKDIR}/build-${TARGET_SYS}"
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "f5e8301b203715404d18215d7d914499555b3425"
|
||||
SRCREV ?= "9fbfbf002e210dbdb2a4b9f3adf8012f245cf38f"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
@@ -69,6 +69,7 @@ SRC_URI = "\
|
||||
file://0037-CVE-2019-14250-Check-zero-value-in-simple_object_elf.patch \
|
||||
file://0038-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
|
||||
file://0039-process_alt_operands-Don-t-match-user-defined-regs-o.patch \
|
||||
file://0002-libstdc-Fix-inconsistent-noexcept-specific-for-valar.patch \
|
||||
"
|
||||
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
|
||||
SRC_URI[sha256sum] = "27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 60d966708d7cf105dccf128d2b7a38b0b2580a1a Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Wakely <jwakely@redhat.com>
|
||||
Date: Fri, 5 Nov 2021 21:42:20 +0000
|
||||
Subject: [PATCH] libstdc++: Fix inconsistent noexcept-specific for valarray
|
||||
begin/end
|
||||
|
||||
These declarations should be noexcept after I added it to the
|
||||
definitions in <valarray>.
|
||||
|
||||
libstdc++-v3/ChangeLog:
|
||||
|
||||
* include/bits/range_access.h (begin(valarray), end(valarray)):
|
||||
Add noexcept.
|
||||
|
||||
(cherry picked from commit 2b2d97fc545635a0f6aa9c9ee3b017394bc494bf)
|
||||
|
||||
Upstream-Status: Backport [https://github.com/hkaelber/gcc/commit/2b2d97fc545635a0f6aa9c9ee3b017394bc494bf]
|
||||
Signed-off-by: Virendra Thakur <virendrak@kpit.com>
|
||||
|
||||
---
|
||||
libstdc++-v3/include/bits/range_access.h | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
|
||||
index 3d99ea92027..4736e75fda1 100644
|
||||
--- a/libstdc++-v3/include/bits/range_access.h
|
||||
+++ b/libstdc++-v3/include/bits/range_access.h
|
||||
@@ -101,10 +101,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _Tp> class valarray;
|
||||
// These overloads must be declared for cbegin and cend to use them.
|
||||
- template<typename _Tp> _Tp* begin(valarray<_Tp>&);
|
||||
- template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
|
||||
- template<typename _Tp> _Tp* end(valarray<_Tp>&);
|
||||
- template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
|
||||
+ template<typename _Tp> _Tp* begin(valarray<_Tp>&) noexcept;
|
||||
+ template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
|
||||
+ template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
|
||||
+ template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Return an iterator pointing to the first element of
|
||||
--
|
||||
2.25.1
|
||||
367
meta/recipes-devtools/git/files/CVE-2022-23521.patch
Normal file
367
meta/recipes-devtools/git/files/CVE-2022-23521.patch
Normal file
@@ -0,0 +1,367 @@
|
||||
From eb22e7dfa23da6bd9aed9bd1dad69e1e8e167d24 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:45:15 +0100
|
||||
Subject: [PATCH] CVE-2022-23521
|
||||
|
||||
attr: fix overflow when upserting attribute with overly long name
|
||||
|
||||
The function `git_attr_internal()` is called to upsert attributes into
|
||||
the global map. And while all callers pass a `size_t`, the function
|
||||
itself accepts an `int` as the attribute name's length. This can lead to
|
||||
an integer overflow in case the attribute name is longer than `INT_MAX`.
|
||||
|
||||
Now this overflow seems harmless as the first thing we do is to call
|
||||
`attr_name_valid()`, and that function only succeeds in case all chars
|
||||
in the range of `namelen` match a certain small set of chars. We thus
|
||||
can't do an out-of-bounds read as NUL is not part of that set and all
|
||||
strings passed to this function are NUL-terminated. And furthermore, we
|
||||
wouldn't ever read past the current attribute name anyway due to the
|
||||
same reason. And if validation fails we will return early.
|
||||
|
||||
On the other hand it feels fragile to rely on this behaviour, even more
|
||||
so given that we pass `namelen` to `FLEX_ALLOC_MEM()`. So let's instead
|
||||
just do the correct thing here and accept a `size_t` as line length.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/eb22e7dfa23da6bd9aed9bd1dad69e1e8e167d24 &https://github.com/git/git/commit/8d0d48cf2157cfb914db1f53b3fe40785b86f3aa & https://github.com/git/git/commit/24557209500e6ed618f04a8795a111a0c491a29c & https://github.com/git/git/commit/34ace8bad02bb14ecc5b631f7e3daaa7a9bba7d9 & https://github.com/git/git/commit/447ac906e189535e77dcb1f4bbe3f1bc917d4c12 & https://github.com/git/git/commit/e1e12e97ac73ded85f7d000da1063a774b3cc14f & https://github.com/git/git/commit/a60a66e409c265b2944f18bf43581c146812586d & https://github.com/git/git/commit/d74b1fd54fdbc45966d12ea907dece11e072fb2b & https://github.com/git/git/commit/dfa6b32b5e599d97448337ed4fc18dd50c90758f & https://github.com/git/git/commit/3c50032ff5289cc45659f21949c8d09e52164579
|
||||
|
||||
CVE: CVE-2022-23521
|
||||
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
attr.c | 97 +++++++++++++++++++++++++++----------------
|
||||
attr.h | 12 ++++++
|
||||
t/t0003-attributes.sh | 59 ++++++++++++++++++++++++++
|
||||
3 files changed, 132 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/attr.c b/attr.c
|
||||
index 11f19b5..63484ab 100644
|
||||
--- a/attr.c
|
||||
+++ b/attr.c
|
||||
@@ -29,7 +29,7 @@ static const char git_attr__unknown[] = "(builtin)unknown";
|
||||
#endif
|
||||
|
||||
struct git_attr {
|
||||
- int attr_nr; /* unique attribute number */
|
||||
+ unsigned int attr_nr; /* unique attribute number */
|
||||
char name[FLEX_ARRAY]; /* attribute name */
|
||||
};
|
||||
|
||||
@@ -221,7 +221,7 @@ static void report_invalid_attr(const char *name, size_t len,
|
||||
* dictionary. If no entry is found, create a new attribute and store it in
|
||||
* the dictionary.
|
||||
*/
|
||||
-static const struct git_attr *git_attr_internal(const char *name, int namelen)
|
||||
+static const struct git_attr *git_attr_internal(const char *name, size_t namelen)
|
||||
{
|
||||
struct git_attr *a;
|
||||
|
||||
@@ -237,8 +237,8 @@ static const struct git_attr *git_attr_internal(const char *name, int namelen)
|
||||
a->attr_nr = hashmap_get_size(&g_attr_hashmap.map);
|
||||
|
||||
attr_hashmap_add(&g_attr_hashmap, a->name, namelen, a);
|
||||
- assert(a->attr_nr ==
|
||||
- (hashmap_get_size(&g_attr_hashmap.map) - 1));
|
||||
+ if (a->attr_nr != hashmap_get_size(&g_attr_hashmap.map) - 1)
|
||||
+ die(_("unable to add additional attribute"));
|
||||
}
|
||||
|
||||
hashmap_unlock(&g_attr_hashmap);
|
||||
@@ -283,7 +283,7 @@ struct match_attr {
|
||||
const struct git_attr *attr;
|
||||
} u;
|
||||
char is_macro;
|
||||
- unsigned num_attr;
|
||||
+ size_t num_attr;
|
||||
struct attr_state state[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
@@ -300,7 +300,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
|
||||
struct attr_state *e)
|
||||
{
|
||||
const char *ep, *equals;
|
||||
- int len;
|
||||
+ size_t len;
|
||||
|
||||
ep = cp + strcspn(cp, blank);
|
||||
equals = strchr(cp, '=');
|
||||
@@ -344,8 +344,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
|
||||
static struct match_attr *parse_attr_line(const char *line, const char *src,
|
||||
int lineno, int macro_ok)
|
||||
{
|
||||
- int namelen;
|
||||
- int num_attr, i;
|
||||
+ size_t namelen, num_attr, i;
|
||||
const char *cp, *name, *states;
|
||||
struct match_attr *res = NULL;
|
||||
int is_macro;
|
||||
@@ -356,6 +355,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
|
||||
return NULL;
|
||||
name = cp;
|
||||
|
||||
+ if (strlen(line) >= ATTR_MAX_LINE_LENGTH) {
|
||||
+ warning(_("ignoring overly long attributes line %d"), lineno);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (*cp == '"' && !unquote_c_style(&pattern, name, &states)) {
|
||||
name = pattern.buf;
|
||||
namelen = pattern.len;
|
||||
@@ -392,10 +396,9 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
|
||||
goto fail_return;
|
||||
}
|
||||
|
||||
- res = xcalloc(1,
|
||||
- sizeof(*res) +
|
||||
- sizeof(struct attr_state) * num_attr +
|
||||
- (is_macro ? 0 : namelen + 1));
|
||||
+ res = xcalloc(1, st_add3(sizeof(*res),
|
||||
+ st_mult(sizeof(struct attr_state), num_attr),
|
||||
+ is_macro ? 0 : namelen + 1));
|
||||
if (is_macro) {
|
||||
res->u.attr = git_attr_internal(name, namelen);
|
||||
} else {
|
||||
@@ -458,11 +461,12 @@ struct attr_stack {
|
||||
|
||||
static void attr_stack_free(struct attr_stack *e)
|
||||
{
|
||||
- int i;
|
||||
+ unsigned i;
|
||||
free(e->origin);
|
||||
for (i = 0; i < e->num_matches; i++) {
|
||||
struct match_attr *a = e->attrs[i];
|
||||
- int j;
|
||||
+ size_t j;
|
||||
+
|
||||
for (j = 0; j < a->num_attr; j++) {
|
||||
const char *setto = a->state[j].setto;
|
||||
if (setto == ATTR__TRUE ||
|
||||
@@ -671,8 +675,8 @@ static void handle_attr_line(struct attr_stack *res,
|
||||
a = parse_attr_line(line, src, lineno, macro_ok);
|
||||
if (!a)
|
||||
return;
|
||||
- ALLOC_GROW(res->attrs, res->num_matches + 1, res->alloc);
|
||||
- res->attrs[res->num_matches++] = a;
|
||||
+ ALLOC_GROW_BY(res->attrs, res->num_matches, 1, res->alloc);
|
||||
+ res->attrs[res->num_matches - 1] = a;
|
||||
}
|
||||
|
||||
static struct attr_stack *read_attr_from_array(const char **list)
|
||||
@@ -711,21 +715,37 @@ void git_attr_set_direction(enum git_attr_direction new_direction)
|
||||
|
||||
static struct attr_stack *read_attr_from_file(const char *path, int macro_ok)
|
||||
{
|
||||
+ struct strbuf buf = STRBUF_INIT;
|
||||
FILE *fp = fopen_or_warn(path, "r");
|
||||
struct attr_stack *res;
|
||||
- char buf[2048];
|
||||
int lineno = 0;
|
||||
+ int fd;
|
||||
+ struct stat st;
|
||||
|
||||
if (!fp)
|
||||
return NULL;
|
||||
- res = xcalloc(1, sizeof(*res));
|
||||
- while (fgets(buf, sizeof(buf), fp)) {
|
||||
- char *bufp = buf;
|
||||
- if (!lineno)
|
||||
- skip_utf8_bom(&bufp, strlen(bufp));
|
||||
- handle_attr_line(res, bufp, path, ++lineno, macro_ok);
|
||||
+
|
||||
+ fd = fileno(fp);
|
||||
+ if (fstat(fd, &st)) {
|
||||
+ warning_errno(_("cannot fstat gitattributes file '%s'"), path);
|
||||
+ fclose(fp);
|
||||
+ return NULL;
|
||||
}
|
||||
+ if (st.st_size >= ATTR_MAX_FILE_SIZE) {
|
||||
+ warning(_("ignoring overly large gitattributes file '%s'"), path);
|
||||
+ fclose(fp);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ CALLOC_ARRAY(res, 1);
|
||||
+ while (strbuf_getline(&buf, fp) != EOF) {
|
||||
+ if (!lineno && starts_with(buf.buf, utf8_bom))
|
||||
+ strbuf_remove(&buf, 0, strlen(utf8_bom));
|
||||
+ handle_attr_line(res, buf.buf, path, ++lineno, macro_ok);
|
||||
+ }
|
||||
+
|
||||
fclose(fp);
|
||||
+ strbuf_release(&buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -736,13 +756,18 @@ static struct attr_stack *read_attr_from_index(const struct index_state *istate,
|
||||
struct attr_stack *res;
|
||||
char *buf, *sp;
|
||||
int lineno = 0;
|
||||
+ size_t size;
|
||||
|
||||
if (!istate)
|
||||
return NULL;
|
||||
|
||||
- buf = read_blob_data_from_index(istate, path, NULL);
|
||||
+ buf = read_blob_data_from_index(istate, path, &size);
|
||||
if (!buf)
|
||||
return NULL;
|
||||
+ if (size >= ATTR_MAX_FILE_SIZE) {
|
||||
+ warning(_("ignoring overly large gitattributes blob '%s'"), path);
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
res = xcalloc(1, sizeof(*res));
|
||||
for (sp = buf; *sp; ) {
|
||||
@@ -1012,12 +1037,12 @@ static int macroexpand_one(struct all_attrs_item *all_attrs, int nr, int rem);
|
||||
static int fill_one(const char *what, struct all_attrs_item *all_attrs,
|
||||
const struct match_attr *a, int rem)
|
||||
{
|
||||
- int i;
|
||||
+ size_t i;
|
||||
|
||||
- for (i = a->num_attr - 1; rem > 0 && i >= 0; i--) {
|
||||
- const struct git_attr *attr = a->state[i].attr;
|
||||
+ for (i = a->num_attr; rem > 0 && i > 0; i--) {
|
||||
+ const struct git_attr *attr = a->state[i - 1].attr;
|
||||
const char **n = &(all_attrs[attr->attr_nr].value);
|
||||
- const char *v = a->state[i].setto;
|
||||
+ const char *v = a->state[i - 1].setto;
|
||||
|
||||
if (*n == ATTR__UNKNOWN) {
|
||||
debug_set(what,
|
||||
@@ -1036,11 +1061,11 @@ static int fill(const char *path, int pathlen, int basename_offset,
|
||||
struct all_attrs_item *all_attrs, int rem)
|
||||
{
|
||||
for (; rem > 0 && stack; stack = stack->prev) {
|
||||
- int i;
|
||||
+ unsigned i;
|
||||
const char *base = stack->origin ? stack->origin : "";
|
||||
|
||||
- for (i = stack->num_matches - 1; 0 < rem && 0 <= i; i--) {
|
||||
- const struct match_attr *a = stack->attrs[i];
|
||||
+ for (i = stack->num_matches; 0 < rem && 0 < i; i--) {
|
||||
+ const struct match_attr *a = stack->attrs[i - 1];
|
||||
if (a->is_macro)
|
||||
continue;
|
||||
if (path_matches(path, pathlen, basename_offset,
|
||||
@@ -1071,11 +1096,11 @@ static void determine_macros(struct all_attrs_item *all_attrs,
|
||||
const struct attr_stack *stack)
|
||||
{
|
||||
for (; stack; stack = stack->prev) {
|
||||
- int i;
|
||||
- for (i = stack->num_matches - 1; i >= 0; i--) {
|
||||
- const struct match_attr *ma = stack->attrs[i];
|
||||
+ unsigned i;
|
||||
+ for (i = stack->num_matches; i > 0; i--) {
|
||||
+ const struct match_attr *ma = stack->attrs[i - 1];
|
||||
if (ma->is_macro) {
|
||||
- int n = ma->u.attr->attr_nr;
|
||||
+ unsigned int n = ma->u.attr->attr_nr;
|
||||
if (!all_attrs[n].macro) {
|
||||
all_attrs[n].macro = ma;
|
||||
}
|
||||
@@ -1127,7 +1152,7 @@ void git_check_attr(const struct index_state *istate,
|
||||
collect_some_attrs(istate, path, check);
|
||||
|
||||
for (i = 0; i < check->nr; i++) {
|
||||
- size_t n = check->items[i].attr->attr_nr;
|
||||
+ unsigned int n = check->items[i].attr->attr_nr;
|
||||
const char *value = check->all_attrs[n].value;
|
||||
if (value == ATTR__UNKNOWN)
|
||||
value = ATTR__UNSET;
|
||||
diff --git a/attr.h b/attr.h
|
||||
index b0378bf..f424285 100644
|
||||
--- a/attr.h
|
||||
+++ b/attr.h
|
||||
@@ -1,6 +1,18 @@
|
||||
#ifndef ATTR_H
|
||||
#define ATTR_H
|
||||
|
||||
+/**
|
||||
+ * The maximum line length for a gitattributes file. If the line exceeds this
|
||||
+ * length we will ignore it.
|
||||
+ */
|
||||
+#define ATTR_MAX_LINE_LENGTH 2048
|
||||
+
|
||||
+ /**
|
||||
+ * The maximum size of the giattributes file. If the file exceeds this size we
|
||||
+ * will ignore it.
|
||||
+ */
|
||||
+#define ATTR_MAX_FILE_SIZE (100 * 1024 * 1024)
|
||||
+
|
||||
struct index_state;
|
||||
|
||||
/* An attribute is a pointer to this opaque structure */
|
||||
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
|
||||
index 71e63d8..556245b 100755
|
||||
--- a/t/t0003-attributes.sh
|
||||
+++ b/t/t0003-attributes.sh
|
||||
@@ -342,4 +342,63 @@ test_expect_success 'query binary macro directly' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'large attributes line ignored in tree' '
|
||||
+ test_when_finished "rm .gitattributes" &&
|
||||
+ printf "path %02043d" 1 >.gitattributes &&
|
||||
+ git check-attr --all path >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'large attributes line ignores trailing content in tree' '
|
||||
+ test_when_finished "rm .gitattributes" &&
|
||||
+ # older versions of Git broke lines at 2048 bytes; the 2045 bytes
|
||||
+ # of 0-padding here is accounting for the three bytes of "a 1", which
|
||||
+ # would knock "trailing" to the "next" line, where it would be
|
||||
+ # erroneously parsed.
|
||||
+ printf "a %02045dtrailing attribute\n" 1 >.gitattributes &&
|
||||
+ git check-attr --all trailing >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE 'large attributes file ignored in tree' '
|
||||
+ test_when_finished "rm .gitattributes" &&
|
||||
+ dd if=/dev/zero of=.gitattributes bs=101M count=1 2>/dev/null &&
|
||||
+ git check-attr --all path >/dev/null 2>err &&
|
||||
+ echo "warning: ignoring overly large gitattributes file ${SQ}.gitattributes${SQ}" >expect &&
|
||||
+ test_cmp expect err
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'large attributes line ignored in index' '
|
||||
+ test_when_finished "git update-index --remove .gitattributes" &&
|
||||
+ blob=$(printf "path %02043d" 1 | git hash-object -w --stdin) &&
|
||||
+ git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
|
||||
+ git check-attr --cached --all path >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'large attributes line ignores trailing content in index' '
|
||||
+ test_when_finished "git update-index --remove .gitattributes" &&
|
||||
+ blob=$(printf "a %02045dtrailing attribute\n" 1 | git hash-object -w --stdin) &&
|
||||
+ git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
|
||||
+ git check-attr --cached --all trailing >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE 'large attributes file ignored in index' '
|
||||
+ test_when_finished "git update-index --remove .gitattributes" &&
|
||||
+ blob=$(dd if=/dev/zero bs=101M count=1 2>/dev/null | git hash-object -w --stdin) &&
|
||||
+ git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
|
||||
+ git check-attr --cached --all path >/dev/null 2>err &&
|
||||
+ echo "warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}" >expect &&
|
||||
+ test_cmp expect err
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
39
meta/recipes-devtools/git/files/CVE-2022-41903-01.patch
Normal file
39
meta/recipes-devtools/git/files/CVE-2022-41903-01.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From a244dc5b0a629290881641467c7a545de7508ab2 Mon Sep 17 00:00:00 2001
|
||||
From: Carlo Marcelo Arenas Belón <carenas@gmail.com>
|
||||
Date: Tue, 2 Nov 2021 15:46:06 +0000
|
||||
Subject: [PATCH 01/12] test-lib: add prerequisite for 64-bit platforms
|
||||
|
||||
Allow tests that assume a 64-bit `size_t` to be skipped in 32-bit
|
||||
platforms and regardless of the size of `long`.
|
||||
|
||||
This imitates the `LONG_IS_64BIT` prerequisite.
|
||||
|
||||
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/a244dc5b0a629290881641467c7a545de7508ab2]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/test-lib.sh | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/t/test-lib.sh b/t/test-lib.sh
|
||||
index e06fa02..db5ec2f 100644
|
||||
--- a/t/test-lib.sh
|
||||
+++ b/t/test-lib.sh
|
||||
@@ -1613,6 +1613,10 @@ build_option () {
|
||||
sed -ne "s/^$1: //p"
|
||||
}
|
||||
|
||||
+test_lazy_prereq SIZE_T_IS_64BIT '
|
||||
+ test 8 -eq "$(build_option sizeof-size_t)"
|
||||
+'
|
||||
+
|
||||
test_lazy_prereq LONG_IS_64BIT '
|
||||
test 8 -le "$(build_option sizeof-long)"
|
||||
'
|
||||
--
|
||||
2.25.1
|
||||
|
||||
187
meta/recipes-devtools/git/files/CVE-2022-41903-02.patch
Normal file
187
meta/recipes-devtools/git/files/CVE-2022-41903-02.patch
Normal file
@@ -0,0 +1,187 @@
|
||||
From 81dc898df9b4b4035534a927f3234a3839b698bf Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:25 +0100
|
||||
Subject: [PATCH 02/12] pretty: fix out-of-bounds write caused by integer overflow
|
||||
|
||||
When using a padding specifier in the pretty format passed to git-log(1)
|
||||
we need to calculate the string length in several places. These string
|
||||
lengths are stored in `int`s though, which means that these can easily
|
||||
overflow when the input lengths exceeds 2GB. This can ultimately lead to
|
||||
an out-of-bounds write when these are used in a call to memcpy(3P):
|
||||
|
||||
==8340==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f1ec62f97fe at pc 0x7f2127e5f427 bp 0x7ffd3bd63de0 sp 0x7ffd3bd63588
|
||||
WRITE of size 1 at 0x7f1ec62f97fe thread T0
|
||||
#0 0x7f2127e5f426 in __interceptor_memcpy /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
|
||||
#1 0x5628e96aa605 in format_and_pad_commit pretty.c:1762
|
||||
#2 0x5628e96aa7f4 in format_commit_item pretty.c:1801
|
||||
#3 0x5628e97cdb24 in strbuf_expand strbuf.c:429
|
||||
#4 0x5628e96ab060 in repo_format_commit_message pretty.c:1869
|
||||
#5 0x5628e96acd0f in pretty_print_commit pretty.c:2161
|
||||
#6 0x5628e95a44c8 in show_log log-tree.c:781
|
||||
#7 0x5628e95a76ba in log_tree_commit log-tree.c:1117
|
||||
#8 0x5628e922bed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#9 0x5628e922c35b in cmd_log_walk builtin/log.c:549
|
||||
#10 0x5628e922f1a2 in cmd_log builtin/log.c:883
|
||||
#11 0x5628e9106993 in run_builtin git.c:466
|
||||
#12 0x5628e9107397 in handle_builtin git.c:721
|
||||
#13 0x5628e9107b07 in run_argv git.c:788
|
||||
#14 0x5628e91088a7 in cmd_main git.c:923
|
||||
#15 0x5628e939d682 in main common-main.c:57
|
||||
#16 0x7f2127c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#17 0x7f2127c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#18 0x5628e91020e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x7f1ec62f97fe is located 2 bytes to the left of 4831838265-byte region [0x7f1ec62f9800,0x7f1fe62f9839)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f2127ebe7ea in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
|
||||
#1 0x5628e98774d4 in xrealloc wrapper.c:136
|
||||
#2 0x5628e97cb01c in strbuf_grow strbuf.c:99
|
||||
#3 0x5628e97ccd42 in strbuf_addchars strbuf.c:327
|
||||
#4 0x5628e96aa55c in format_and_pad_commit pretty.c:1761
|
||||
#5 0x5628e96aa7f4 in format_commit_item pretty.c:1801
|
||||
#6 0x5628e97cdb24 in strbuf_expand strbuf.c:429
|
||||
#7 0x5628e96ab060 in repo_format_commit_message pretty.c:1869
|
||||
#8 0x5628e96acd0f in pretty_print_commit pretty.c:2161
|
||||
#9 0x5628e95a44c8 in show_log log-tree.c:781
|
||||
#10 0x5628e95a76ba in log_tree_commit log-tree.c:1117
|
||||
#11 0x5628e922bed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#12 0x5628e922c35b in cmd_log_walk builtin/log.c:549
|
||||
#13 0x5628e922f1a2 in cmd_log builtin/log.c:883
|
||||
#14 0x5628e9106993 in run_builtin git.c:466
|
||||
#15 0x5628e9107397 in handle_builtin git.c:721
|
||||
#16 0x5628e9107b07 in run_argv git.c:788
|
||||
#17 0x5628e91088a7 in cmd_main git.c:923
|
||||
#18 0x5628e939d682 in main common-main.c:57
|
||||
#19 0x7f2127c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#20 0x7f2127c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#21 0x5628e91020e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827 in __interceptor_memcpy
|
||||
Shadow bytes around the buggy address:
|
||||
0x0fe458c572a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
=>0x0fe458c572f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
|
||||
0x0fe458c57300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
==8340==ABORTING
|
||||
|
||||
The pretty format can also be used in `git archive` operations via the
|
||||
`export-subst` attribute. So this is what in our opinion makes this a
|
||||
critical issue in the context of Git forges which allow to download an
|
||||
archive of user supplied Git repositories.
|
||||
|
||||
Fix this vulnerability by using `size_t` instead of `int` to track the
|
||||
string lengths. Add tests which detect this vulnerability when Git is
|
||||
compiled with the address sanitizer.
|
||||
|
||||
Reported-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
|
||||
Original-patch-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
|
||||
Modified-by: Taylor Blau <me@ttalorr.com>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/81dc898df9b4b4035534a927f3234a3839b698bf]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 11 ++++++-----
|
||||
t/t4205-log-pretty-formats.sh | 17 +++++++++++++++++
|
||||
2 files changed, 23 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index b32f036..637e344 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1427,7 +1427,9 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
struct format_commit_context *c)
|
||||
{
|
||||
struct strbuf local_sb = STRBUF_INIT;
|
||||
- int total_consumed = 0, len, padding = c->padding;
|
||||
+ size_t total_consumed = 0;
|
||||
+ int len, padding = c->padding;
|
||||
+
|
||||
if (padding < 0) {
|
||||
const char *start = strrchr(sb->buf, '\n');
|
||||
int occupied;
|
||||
@@ -1439,7 +1441,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
}
|
||||
while (1) {
|
||||
int modifier = *placeholder == 'C';
|
||||
- int consumed = format_commit_one(&local_sb, placeholder, c);
|
||||
+ size_t consumed = format_commit_one(&local_sb, placeholder, c);
|
||||
total_consumed += consumed;
|
||||
|
||||
if (!modifier)
|
||||
@@ -1505,7 +1507,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
}
|
||||
strbuf_addbuf(sb, &local_sb);
|
||||
} else {
|
||||
- int sb_len = sb->len, offset = 0;
|
||||
+ size_t sb_len = sb->len, offset = 0;
|
||||
if (c->flush_type == flush_left)
|
||||
offset = padding - len;
|
||||
else if (c->flush_type == flush_both)
|
||||
@@ -1528,8 +1530,7 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
|
||||
const char *placeholder,
|
||||
void *context)
|
||||
{
|
||||
- int consumed;
|
||||
- size_t orig_len;
|
||||
+ size_t consumed, orig_len;
|
||||
enum {
|
||||
NO_MAGIC,
|
||||
ADD_LF_BEFORE_NON_EMPTY,
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index f42a69f..a2acee1 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -788,4 +788,21 @@ test_expect_success '%S in git log --format works with other placeholders (part
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
+ # We only assert that this command does not crash. This needs to be
|
||||
+ # executed with the address sanitizer to demonstrate failure.
|
||||
+ git log -1 --pretty="format:%>(2147483646)%x41%41%>(2147483646)%x41" >/dev/null
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'set up huge commit' '
|
||||
+ test-tool genzeros 2147483649 | tr "\000" "1" >expect &&
|
||||
+ huge_commit=$(git commit-tree -F expect HEAD^{tree})
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
+ git log -1 --format="%B%<(1)%x30" $huge_commit >actual &&
|
||||
+ echo 0 >>expect &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
146
meta/recipes-devtools/git/files/CVE-2022-41903-03.patch
Normal file
146
meta/recipes-devtools/git/files/CVE-2022-41903-03.patch
Normal file
@@ -0,0 +1,146 @@
|
||||
From b49f309aa16febeddb65e82526640a91bbba3be3 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:30 +0100
|
||||
Subject: [PATCH 03/12] pretty: fix out-of-bounds read when left-flushing with stealing
|
||||
|
||||
With the `%>>(<N>)` pretty formatter, you can ask git-log(1) et al to
|
||||
steal spaces. To do so we need to look ahead of the next token to see
|
||||
whether there are spaces there. This loop takes into account ANSI
|
||||
sequences that end with an `m`, and if it finds any it will skip them
|
||||
until it finds the first space. While doing so it does not take into
|
||||
account the buffer's limits though and easily does an out-of-bounds
|
||||
read.
|
||||
|
||||
Add a test that hits this behaviour. While we don't have an easy way to
|
||||
verify this, the test causes the following failure when run with
|
||||
`SANITIZE=address`:
|
||||
|
||||
==37941==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000000baf at pc 0x55ba6f88e0d0 bp 0x7ffc84c50d20 sp 0x7ffc84c50d10
|
||||
READ of size 1 at 0x603000000baf thread T0
|
||||
#0 0x55ba6f88e0cf in format_and_pad_commit pretty.c:1712
|
||||
#1 0x55ba6f88e7b4 in format_commit_item pretty.c:1801
|
||||
#2 0x55ba6f9b1ae4 in strbuf_expand strbuf.c:429
|
||||
#3 0x55ba6f88f020 in repo_format_commit_message pretty.c:1869
|
||||
#4 0x55ba6f890ccf in pretty_print_commit pretty.c:2161
|
||||
#5 0x55ba6f7884c8 in show_log log-tree.c:781
|
||||
#6 0x55ba6f78b6ba in log_tree_commit log-tree.c:1117
|
||||
#7 0x55ba6f40fed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#8 0x55ba6f41035b in cmd_log_walk builtin/log.c:549
|
||||
#9 0x55ba6f4131a2 in cmd_log builtin/log.c:883
|
||||
#10 0x55ba6f2ea993 in run_builtin git.c:466
|
||||
#11 0x55ba6f2eb397 in handle_builtin git.c:721
|
||||
#12 0x55ba6f2ebb07 in run_argv git.c:788
|
||||
#13 0x55ba6f2ec8a7 in cmd_main git.c:923
|
||||
#14 0x55ba6f581682 in main common-main.c:57
|
||||
#15 0x7f2d08c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#16 0x7f2d08c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#17 0x55ba6f2e60e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x603000000baf is located 1 bytes to the left of 24-byte region [0x603000000bb0,0x603000000bc8)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f2d08ebe7ea in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
|
||||
#1 0x55ba6fa5b494 in xrealloc wrapper.c:136
|
||||
#2 0x55ba6f9aefdc in strbuf_grow strbuf.c:99
|
||||
#3 0x55ba6f9b0a06 in strbuf_add strbuf.c:298
|
||||
#4 0x55ba6f9b1a25 in strbuf_expand strbuf.c:418
|
||||
#5 0x55ba6f88f020 in repo_format_commit_message pretty.c:1869
|
||||
#6 0x55ba6f890ccf in pretty_print_commit pretty.c:2161
|
||||
#7 0x55ba6f7884c8 in show_log log-tree.c:781
|
||||
#8 0x55ba6f78b6ba in log_tree_commit log-tree.c:1117
|
||||
#9 0x55ba6f40fed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#10 0x55ba6f41035b in cmd_log_walk builtin/log.c:549
|
||||
#11 0x55ba6f4131a2 in cmd_log builtin/log.c:883
|
||||
#12 0x55ba6f2ea993 in run_builtin git.c:466
|
||||
#13 0x55ba6f2eb397 in handle_builtin git.c:721
|
||||
#14 0x55ba6f2ebb07 in run_argv git.c:788
|
||||
#15 0x55ba6f2ec8a7 in cmd_main git.c:923
|
||||
#16 0x55ba6f581682 in main common-main.c:57
|
||||
#17 0x7f2d08c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#18 0x7f2d08c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#19 0x55ba6f2e60e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow pretty.c:1712 in format_and_pad_commit
|
||||
Shadow bytes around the buggy address:
|
||||
0x0c067fff8120: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
||||
0x0c067fff8130: fd fd fa fa fd fd fd fd fa fa fd fd fd fa fa fa
|
||||
0x0c067fff8140: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
|
||||
0x0c067fff8150: fa fa fd fd fd fd fa fa 00 00 00 fa fa fa fd fd
|
||||
0x0c067fff8160: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
|
||||
=>0x0c067fff8170: fd fd fd fa fa[fa]00 00 00 fa fa fa 00 00 00 fa
|
||||
0x0c067fff8180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff81a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff81b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff81c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
|
||||
Luckily enough, this would only cause us to copy the out-of-bounds data
|
||||
into the formatted commit in case we really had an ANSI sequence
|
||||
preceding our buffer. So this bug likely has no security consequences.
|
||||
|
||||
Fix it regardless by not traversing past the buffer's start.
|
||||
|
||||
Reported-by: Patrick Steinhardt <ps@pks.im>
|
||||
Reported-by: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/b49f309aa16febeddb65e82526640a91bbba3be3]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 2 +-
|
||||
t/t4205-log-pretty-formats.sh | 6 ++++++
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index 637e344..4348a82 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1468,7 +1468,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
if (*ch != 'm')
|
||||
break;
|
||||
p = ch - 1;
|
||||
- while (ch - p < 10 && *p != '\033')
|
||||
+ while (p > sb->buf && ch - p < 10 && *p != '\033')
|
||||
p--;
|
||||
if (*p != '\033' ||
|
||||
ch + 1 - p != display_mode_esc_sequence_len(p))
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index a2acee1..e69caba 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -788,6 +788,12 @@ test_expect_success '%S in git log --format works with other placeholders (part
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with space stealing' '
|
||||
+ printf mm0 >expect &&
|
||||
+ git log -1 --pretty="format:mm%>>|(1)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
150
meta/recipes-devtools/git/files/CVE-2022-41903-04.patch
Normal file
150
meta/recipes-devtools/git/files/CVE-2022-41903-04.patch
Normal file
@@ -0,0 +1,150 @@
|
||||
From f6e0b9f38987ad5e47bab551f8760b70689a5905 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:34 +0100
|
||||
Subject: [PATCH 04/12] pretty: fix out-of-bounds read when parsing invalid padding format
|
||||
|
||||
An out-of-bounds read can be triggered when parsing an incomplete
|
||||
padding format string passed via `--pretty=format` or in Git archives
|
||||
when files are marked with the `export-subst` gitattribute.
|
||||
|
||||
This bug exists since we have introduced support for truncating output
|
||||
via the `trunc` keyword a7f01c6 (pretty: support truncating in %>, %<
|
||||
and %><, 2013-04-19). Before this commit, we used to find the end of the
|
||||
formatting string by using strchr(3P). This function returns a `NULL`
|
||||
pointer in case the character in question wasn't found. The subsequent
|
||||
check whether any character was found thus simply checked the returned
|
||||
pointer. After the commit we switched to strcspn(3P) though, which only
|
||||
returns the offset to the first found character or to the trailing NUL
|
||||
byte. As the end pointer is now computed by adding the offset to the
|
||||
start pointer it won't be `NULL` anymore, and as a consequence the check
|
||||
doesn't do anything anymore.
|
||||
|
||||
The out-of-bounds data that is being read can in fact end up in the
|
||||
formatted string. As a consequence, it is possible to leak memory
|
||||
contents either by calling git-log(1) or via git-archive(1) when any of
|
||||
the archived files is marked with the `export-subst` gitattribute.
|
||||
|
||||
==10888==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000398 at pc 0x7f0356047cb2 bp 0x7fff3ffb95d0 sp 0x7fff3ffb8d78
|
||||
READ of size 1 at 0x602000000398 thread T0
|
||||
#0 0x7f0356047cb1 in __interceptor_strchrnul /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:725
|
||||
#1 0x563b7cec9a43 in strbuf_expand strbuf.c:417
|
||||
#2 0x563b7cda7060 in repo_format_commit_message pretty.c:1869
|
||||
#3 0x563b7cda8d0f in pretty_print_commit pretty.c:2161
|
||||
#4 0x563b7cca04c8 in show_log log-tree.c:781
|
||||
#5 0x563b7cca36ba in log_tree_commit log-tree.c:1117
|
||||
#6 0x563b7c927ed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#7 0x563b7c92835b in cmd_log_walk builtin/log.c:549
|
||||
#8 0x563b7c92b1a2 in cmd_log builtin/log.c:883
|
||||
#9 0x563b7c802993 in run_builtin git.c:466
|
||||
#10 0x563b7c803397 in handle_builtin git.c:721
|
||||
#11 0x563b7c803b07 in run_argv git.c:788
|
||||
#12 0x563b7c8048a7 in cmd_main git.c:923
|
||||
#13 0x563b7ca99682 in main common-main.c:57
|
||||
#14 0x7f0355e3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#15 0x7f0355e3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#16 0x563b7c7fe0e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x602000000398 is located 0 bytes to the right of 8-byte region [0x602000000390,0x602000000398)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f0356072faa in __interceptor_strdup /usr/src/debug/gcc/libsanitizer/asan/asan_interceptors.cpp:439
|
||||
#1 0x563b7cf7317c in xstrdup wrapper.c:39
|
||||
#2 0x563b7cd9a06a in save_user_format pretty.c:40
|
||||
#3 0x563b7cd9b3e5 in get_commit_format pretty.c:173
|
||||
#4 0x563b7ce54ea0 in handle_revision_opt revision.c:2456
|
||||
#5 0x563b7ce597c9 in setup_revisions revision.c:2850
|
||||
#6 0x563b7c9269e0 in cmd_log_init_finish builtin/log.c:269
|
||||
#7 0x563b7c927362 in cmd_log_init builtin/log.c:348
|
||||
#8 0x563b7c92b193 in cmd_log builtin/log.c:882
|
||||
#9 0x563b7c802993 in run_builtin git.c:466
|
||||
#10 0x563b7c803397 in handle_builtin git.c:721
|
||||
#11 0x563b7c803b07 in run_argv git.c:788
|
||||
#12 0x563b7c8048a7 in cmd_main git.c:923
|
||||
#13 0x563b7ca99682 in main common-main.c:57
|
||||
#14 0x7f0355e3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#15 0x7f0355e3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#16 0x563b7c7fe0e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:725 in __interceptor_strchrnul
|
||||
Shadow bytes around the buggy address:
|
||||
0x0c047fff8020: fa fa fd fd fa fa 00 06 fa fa 05 fa fa fa fd fd
|
||||
0x0c047fff8030: fa fa 00 02 fa fa 06 fa fa fa 05 fa fa fa fd fd
|
||||
0x0c047fff8040: fa fa 00 07 fa fa 03 fa fa fa fd fd fa fa 00 00
|
||||
0x0c047fff8050: fa fa 00 01 fa fa fd fd fa fa 00 00 fa fa 00 01
|
||||
0x0c047fff8060: fa fa 00 06 fa fa 00 06 fa fa 05 fa fa fa 05 fa
|
||||
=>0x0c047fff8070: fa fa 00[fa]fa fa fd fa fa fa fd fd fa fa fd fd
|
||||
0x0c047fff8080: fa fa fd fd fa fa 00 00 fa fa 00 fa fa fa fd fa
|
||||
0x0c047fff8090: fa fa fd fd fa fa 00 00 fa fa fa fa fa fa fa fa
|
||||
0x0c047fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c047fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c047fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
==10888==ABORTING
|
||||
|
||||
Fix this bug by checking whether `end` points at the trailing NUL byte.
|
||||
Add a test which catches this out-of-bounds read and which demonstrates
|
||||
that we used to write out-of-bounds data into the formatted message.
|
||||
|
||||
Reported-by: Markus Vervier <markus.vervier@x41-dsec.de>
|
||||
Original-patch-by: Markus Vervier <markus.vervier@x41-dsec.de>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/f6e0b9f38987ad5e47bab551f8760b70689a5905]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 2 +-
|
||||
t/t4205-log-pretty-formats.sh | 6 ++++++
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index 4348a82..c49e818 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1024,7 +1024,7 @@ static size_t parse_padding_placeholder(const char *placeholder,
|
||||
const char *end = start + strcspn(start, ",)");
|
||||
char *next;
|
||||
int width;
|
||||
- if (!end || end == start)
|
||||
+ if (!*end || end == start)
|
||||
return 0;
|
||||
width = strtol(start, &next, 10);
|
||||
if (next == start || width == 0)
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index e69caba..8a349df 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -794,6 +794,12 @@ test_expect_success 'log --pretty with space stealing' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with invalid padding format' '
|
||||
+ printf "%s%%<(20" "$(git rev-parse HEAD)" >expect &&
|
||||
+ git log -1 --pretty="format:%H%<(20" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
98
meta/recipes-devtools/git/files/CVE-2022-41903-05.patch
Normal file
98
meta/recipes-devtools/git/files/CVE-2022-41903-05.patch
Normal file
@@ -0,0 +1,98 @@
|
||||
From 1de69c0cdd388b0a5b7bdde0bfa0bda514a354b0 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:39 +0100
|
||||
Subject: [PATCH 05/12] pretty: fix adding linefeed when placeholder is not expanded
|
||||
|
||||
When a formatting directive has a `+` or ` ` after the `%`, then we add
|
||||
either a line feed or space if the placeholder expands to a non-empty
|
||||
string. In specific cases though this logic doesn't work as expected,
|
||||
and we try to add the character even in the case where the formatting
|
||||
directive is empty.
|
||||
|
||||
One such pattern is `%w(1)%+d%+w(2)`. `%+d` expands to reference names
|
||||
pointing to a certain commit, like in `git log --decorate`. For a tagged
|
||||
commit this would for example expand to `\n (tag: v1.0.0)`, which has a
|
||||
leading newline due to the `+` modifier and a space added by `%d`. Now
|
||||
the second wrapping directive will cause us to rewrap the text to
|
||||
`\n(tag:\nv1.0.0)`, which is one byte shorter due to the missing leading
|
||||
space. The code that handles the `+` magic now notices that the length
|
||||
has changed and will thus try to insert a leading line feed at the
|
||||
original posititon. But as the string was shortened, the original
|
||||
position is past the buffer's boundary and thus we die with an error.
|
||||
|
||||
Now there are two issues here:
|
||||
|
||||
1. We check whether the buffer length has changed, not whether it
|
||||
has been extended. This causes us to try and add the character
|
||||
past the string boundary.
|
||||
|
||||
2. The current logic does not make any sense whatsoever. When the
|
||||
string got expanded due to the rewrap, putting the separator into
|
||||
the original position is likely to put it somewhere into the
|
||||
middle of the rewrapped contents.
|
||||
|
||||
It is debatable whether `%+w()` makes any sense in the first place.
|
||||
Strictly speaking, the placeholder never expands to a non-empty string,
|
||||
and consequentially we shouldn't ever accept this combination. We thus
|
||||
fix the bug by simply refusing `%+w()`.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/1de69c0cdd388b0a5b7bdde0bfa0bda514a354b0]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 14 +++++++++++++-
|
||||
t/t4205-log-pretty-formats.sh | 8 ++++++++
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index c49e818..195d005 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1551,9 +1551,21 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
- if (magic != NO_MAGIC)
|
||||
+ if (magic != NO_MAGIC) {
|
||||
placeholder++;
|
||||
|
||||
+ switch (placeholder[0]) {
|
||||
+ case 'w':
|
||||
+ /*
|
||||
+ * `%+w()` cannot ever expand to a non-empty string,
|
||||
+ * and it potentially changes the layout of preceding
|
||||
+ * contents. We're thus not able to handle the magic in
|
||||
+ * this combination and refuse the pattern.
|
||||
+ */
|
||||
+ return 0;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
orig_len = sb->len;
|
||||
if (((struct format_commit_context *)context)->flush_type != no_flush)
|
||||
consumed = format_and_pad_commit(sb, placeholder, context);
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 8a349df..fa1bc2b 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -800,6 +800,14 @@ test_expect_success 'log --pretty with invalid padding format' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with magical wrapping directives' '
|
||||
+ commit_id=$(git commit-tree HEAD^{tree} -m "describe me") &&
|
||||
+ git tag describe-me $commit_id &&
|
||||
+ printf "\n(tag:\ndescribe-me)%%+w(2)" >expect &&
|
||||
+ git log -1 --pretty="format:%w(1)%+d%+w(2)" $commit_id >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
90
meta/recipes-devtools/git/files/CVE-2022-41903-06.patch
Normal file
90
meta/recipes-devtools/git/files/CVE-2022-41903-06.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From 48050c42c73c28b0c001d63d11dffac7e116847b Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:49 +0100
|
||||
Subject: [PATCH 06/12] pretty: fix integer overflow in wrapping format
|
||||
|
||||
The `%w(width,indent1,indent2)` formatting directive can be used to
|
||||
rewrap text to a specific width and is designed after git-shortlog(1)'s
|
||||
`-w` parameter. While the three parameters are all stored as `size_t`
|
||||
internally, `strbuf_add_wrapped_text()` accepts integers as input. As a
|
||||
result, the casted integers may overflow. As these now-negative integers
|
||||
are later on passed to `strbuf_addchars()`, we will ultimately run into
|
||||
implementation-defined behaviour due to casting a negative number back
|
||||
to `size_t` again. On my platform, this results in trying to allocate
|
||||
9000 petabyte of memory.
|
||||
|
||||
Fix this overflow by using `cast_size_t_to_int()` so that we reject
|
||||
inputs that cannot be represented as an integer.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/48050c42c73c28b0c001d63d11dffac7e116847b]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
git-compat-util.h | 8 ++++++++
|
||||
pretty.c | 4 +++-
|
||||
t/t4205-log-pretty-formats.sh | 12 ++++++++++++
|
||||
3 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/git-compat-util.h b/git-compat-util.h
|
||||
index a1ecfd3..b0f3890 100644
|
||||
--- a/git-compat-util.h
|
||||
+++ b/git-compat-util.h
|
||||
@@ -854,6 +854,14 @@ static inline size_t st_sub(size_t a, size_t b)
|
||||
return a - b;
|
||||
}
|
||||
|
||||
+static inline int cast_size_t_to_int(size_t a)
|
||||
+{
|
||||
+ if (a > INT_MAX)
|
||||
+ die("number too large to represent as int on this platform: %"PRIuMAX,
|
||||
+ (uintmax_t)a);
|
||||
+ return (int)a;
|
||||
+}
|
||||
+
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# define xalloca(size) (alloca(size))
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index 195d005..ff9fc97 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -898,7 +898,9 @@ static void strbuf_wrap(struct strbuf *sb, size_t pos,
|
||||
if (pos)
|
||||
strbuf_add(&tmp, sb->buf, pos);
|
||||
strbuf_add_wrapped_text(&tmp, sb->buf + pos,
|
||||
- (int) indent1, (int) indent2, (int) width);
|
||||
+ cast_size_t_to_int(indent1),
|
||||
+ cast_size_t_to_int(indent2),
|
||||
+ cast_size_t_to_int(width));
|
||||
strbuf_swap(&tmp, sb);
|
||||
strbuf_release(&tmp);
|
||||
}
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index fa1bc2b..23ac508 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -808,6 +808,18 @@ test_expect_success 'log --pretty with magical wrapping directives' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing wrapping directive' '
|
||||
+ cat >expect <<-EOF &&
|
||||
+ fatal: number too large to represent as int on this platform: 2147483649
|
||||
+ EOF
|
||||
+ test_must_fail git log -1 --pretty="format:%w(2147483649,1,1)%d" 2>error &&
|
||||
+ test_cmp expect error &&
|
||||
+ test_must_fail git log -1 --pretty="format:%w(1,2147483649,1)%d" 2>error &&
|
||||
+ test_cmp expect error &&
|
||||
+ test_must_fail git log -1 --pretty="format:%w(1,1,2147483649)%d" 2>error &&
|
||||
+ test_cmp expect error
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
123
meta/recipes-devtools/git/files/CVE-2022-41903-07.patch
Normal file
123
meta/recipes-devtools/git/files/CVE-2022-41903-07.patch
Normal file
@@ -0,0 +1,123 @@
|
||||
From 522cc87fdc25449222a5894a428eebf4b8d5eaa9 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:53 +0100
|
||||
Subject: [PATCH 07/12] utf8: fix truncated string lengths in utf8_strnwidth()
|
||||
|
||||
The `utf8_strnwidth()` function accepts an optional string length as
|
||||
input parameter. This parameter can either be set to `-1`, in which case
|
||||
we call `strlen()` on the input. Or it can be set to a positive integer
|
||||
that indicates a precomputed length, which callers typically compute by
|
||||
calling `strlen()` at some point themselves.
|
||||
|
||||
The input parameter is an `int` though, whereas `strlen()` returns a
|
||||
`size_t`. This can lead to implementation-defined behaviour though when
|
||||
the `size_t` cannot be represented by the `int`. In the general case
|
||||
though this leads to wrap-around and thus to negative string sizes,
|
||||
which is sure enough to not lead to well-defined behaviour.
|
||||
|
||||
Fix this by accepting a `size_t` instead of an `int` as string length.
|
||||
While this takes away the ability of callers to simply pass in `-1` as
|
||||
string length, it really is trivial enough to convert them to instead
|
||||
pass in `strlen()` instead.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/522cc87fdc25449222a5894a428eebf4b8d5eaa9]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
column.c | 2 +-
|
||||
pretty.c | 4 ++--
|
||||
utf8.c | 8 +++-----
|
||||
utf8.h | 2 +-
|
||||
4 files changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/column.c b/column.c
|
||||
index 4a38eed..0c79850 100644
|
||||
--- a/column.c
|
||||
+++ b/column.c
|
||||
@@ -23,7 +23,7 @@ struct column_data {
|
||||
/* return length of 's' in letters, ANSI escapes stripped */
|
||||
static int item_length(const char *s)
|
||||
{
|
||||
- return utf8_strnwidth(s, -1, 1);
|
||||
+ return utf8_strnwidth(s, strlen(s), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index ff9fc97..c3c1443 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1437,7 +1437,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
int occupied;
|
||||
if (!start)
|
||||
start = sb->buf;
|
||||
- occupied = utf8_strnwidth(start, -1, 1);
|
||||
+ occupied = utf8_strnwidth(start, strlen(start), 1);
|
||||
occupied += c->pretty_ctx->graph_width;
|
||||
padding = (-padding) - occupied;
|
||||
}
|
||||
@@ -1455,7 +1455,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
placeholder++;
|
||||
total_consumed++;
|
||||
}
|
||||
- len = utf8_strnwidth(local_sb.buf, -1, 1);
|
||||
+ len = utf8_strnwidth(local_sb.buf, local_sb.len, 1);
|
||||
|
||||
if (c->flush_type == flush_left_and_steal) {
|
||||
const char *ch = sb->buf + sb->len - 1;
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index 5c8f151..a66984b 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -206,13 +206,11 @@ int utf8_width(const char **start, size_t *remainder_p)
|
||||
* string, assuming that the string is utf8. Returns strlen() instead
|
||||
* if the string does not look like a valid utf8 string.
|
||||
*/
|
||||
-int utf8_strnwidth(const char *string, int len, int skip_ansi)
|
||||
+int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
{
|
||||
int width = 0;
|
||||
const char *orig = string;
|
||||
|
||||
- if (len == -1)
|
||||
- len = strlen(string);
|
||||
while (string && string < orig + len) {
|
||||
int skip;
|
||||
while (skip_ansi &&
|
||||
@@ -225,7 +223,7 @@ int utf8_strnwidth(const char *string, int len, int skip_ansi)
|
||||
|
||||
int utf8_strwidth(const char *string)
|
||||
{
|
||||
- return utf8_strnwidth(string, -1, 0);
|
||||
+ return utf8_strnwidth(string, strlen(string), 0);
|
||||
}
|
||||
|
||||
int is_utf8(const char *text)
|
||||
@@ -792,7 +790,7 @@ int skip_utf8_bom(char **text, size_t len)
|
||||
void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned int width,
|
||||
const char *s)
|
||||
{
|
||||
- int slen = strlen(s);
|
||||
+ size_t slen = strlen(s);
|
||||
int display_len = utf8_strnwidth(s, slen, 0);
|
||||
int utf8_compensation = slen - display_len;
|
||||
|
||||
diff --git a/utf8.h b/utf8.h
|
||||
index fcd5167..6da1b6d 100644
|
||||
--- a/utf8.h
|
||||
+++ b/utf8.h
|
||||
@@ -7,7 +7,7 @@ typedef unsigned int ucs_char_t; /* assuming 32bit int */
|
||||
|
||||
size_t display_mode_esc_sequence_len(const char *s);
|
||||
int utf8_width(const char **start, size_t *remainder_p);
|
||||
-int utf8_strnwidth(const char *string, int len, int skip_ansi);
|
||||
+int utf8_strnwidth(const char *string, size_t len, int skip_ansi);
|
||||
int utf8_strwidth(const char *string);
|
||||
int is_utf8(const char *text);
|
||||
int is_encoding_utf8(const char *name);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
67
meta/recipes-devtools/git/files/CVE-2022-41903-08.patch
Normal file
67
meta/recipes-devtools/git/files/CVE-2022-41903-08.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From 17d23e8a3812a5ca3dd6564e74d5250f22e5d76d Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:00 +0100
|
||||
Subject: [PATCH 08/12] utf8: fix returning negative string width
|
||||
|
||||
The `utf8_strnwidth()` function calls `utf8_width()` in a loop and adds
|
||||
its returned width to the end result. `utf8_width()` can return `-1`
|
||||
though in case it reads a control character, which means that the
|
||||
computed string width is going to be wrong. In the worst case where
|
||||
there are more control characters than non-control characters, we may
|
||||
even return a negative string width.
|
||||
|
||||
Fix this bug by treating control characters as having zero width.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/17d23e8a3812a5ca3dd6564e74d5250f22e5d76d]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/t4205-log-pretty-formats.sh | 6 ++++++
|
||||
utf8.c | 8 ++++++--
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 23ac508..261a6f0 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -820,6 +820,12 @@ test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing wrapping dire
|
||||
test_cmp expect error
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with padding and preceding control chars' '
|
||||
+ printf "\20\20 0" >expect &&
|
||||
+ git log -1 --pretty="format:%x10%x10%>|(4)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index a66984b..6632bd2 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -212,11 +212,15 @@ int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
const char *orig = string;
|
||||
|
||||
while (string && string < orig + len) {
|
||||
- int skip;
|
||||
+ int glyph_width, skip;
|
||||
+
|
||||
while (skip_ansi &&
|
||||
(skip = display_mode_esc_sequence_len(string)) != 0)
|
||||
string += skip;
|
||||
- width += utf8_width(&string, NULL);
|
||||
+
|
||||
+ glyph_width = utf8_width(&string, NULL);
|
||||
+ if (glyph_width > 0)
|
||||
+ width += glyph_width;
|
||||
}
|
||||
return string ? width : len;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
162
meta/recipes-devtools/git/files/CVE-2022-41903-09.patch
Normal file
162
meta/recipes-devtools/git/files/CVE-2022-41903-09.patch
Normal file
@@ -0,0 +1,162 @@
|
||||
From 937b71cc8b5b998963a7f9a33312ba3549d55510 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:04 +0100
|
||||
Subject: [PATCH 09/12] utf8: fix overflow when returning string width
|
||||
|
||||
The return type of both `utf8_strwidth()` and `utf8_strnwidth()` is
|
||||
`int`, but we operate on string lengths which are typically of type
|
||||
`size_t`. This means that when the string is longer than `INT_MAX`, we
|
||||
will overflow and thus return a negative result.
|
||||
|
||||
This can lead to an out-of-bounds write with `--pretty=format:%<1)%B`
|
||||
and a commit message that is 2^31+1 bytes long:
|
||||
|
||||
=================================================================
|
||||
==26009==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000001168 at pc 0x7f95c4e5f427 bp 0x7ffd8541c900 sp 0x7ffd8541c0a8
|
||||
WRITE of size 2147483649 at 0x603000001168 thread T0
|
||||
#0 0x7f95c4e5f426 in __interceptor_memcpy /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
|
||||
#1 0x5612bbb1068c in format_and_pad_commit pretty.c:1763
|
||||
#2 0x5612bbb1087a in format_commit_item pretty.c:1801
|
||||
#3 0x5612bbc33bab in strbuf_expand strbuf.c:429
|
||||
#4 0x5612bbb110e7 in repo_format_commit_message pretty.c:1869
|
||||
#5 0x5612bbb12d96 in pretty_print_commit pretty.c:2161
|
||||
#6 0x5612bba0a4d5 in show_log log-tree.c:781
|
||||
#7 0x5612bba0d6c7 in log_tree_commit log-tree.c:1117
|
||||
#8 0x5612bb691ed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#9 0x5612bb69235b in cmd_log_walk builtin/log.c:549
|
||||
#10 0x5612bb6951a2 in cmd_log builtin/log.c:883
|
||||
#11 0x5612bb56c993 in run_builtin git.c:466
|
||||
#12 0x5612bb56d397 in handle_builtin git.c:721
|
||||
#13 0x5612bb56db07 in run_argv git.c:788
|
||||
#14 0x5612bb56e8a7 in cmd_main git.c:923
|
||||
#15 0x5612bb803682 in main common-main.c:57
|
||||
#16 0x7f95c4c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#17 0x7f95c4c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#18 0x5612bb5680e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x603000001168 is located 0 bytes to the right of 24-byte region [0x603000001150,0x603000001168)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f95c4ebe7ea in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
|
||||
#1 0x5612bbcdd556 in xrealloc wrapper.c:136
|
||||
#2 0x5612bbc310a3 in strbuf_grow strbuf.c:99
|
||||
#3 0x5612bbc32acd in strbuf_add strbuf.c:298
|
||||
#4 0x5612bbc33aec in strbuf_expand strbuf.c:418
|
||||
#5 0x5612bbb110e7 in repo_format_commit_message pretty.c:1869
|
||||
#6 0x5612bbb12d96 in pretty_print_commit pretty.c:2161
|
||||
#7 0x5612bba0a4d5 in show_log log-tree.c:781
|
||||
#8 0x5612bba0d6c7 in log_tree_commit log-tree.c:1117
|
||||
#9 0x5612bb691ed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#10 0x5612bb69235b in cmd_log_walk builtin/log.c:549
|
||||
#11 0x5612bb6951a2 in cmd_log builtin/log.c:883
|
||||
#12 0x5612bb56c993 in run_builtin git.c:466
|
||||
#13 0x5612bb56d397 in handle_builtin git.c:721
|
||||
#14 0x5612bb56db07 in run_argv git.c:788
|
||||
#15 0x5612bb56e8a7 in cmd_main git.c:923
|
||||
#16 0x5612bb803682 in main common-main.c:57
|
||||
#17 0x7f95c4c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827 in __interceptor_memcpy
|
||||
Shadow bytes around the buggy address:
|
||||
0x0c067fff81d0: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
|
||||
0x0c067fff81e0: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
|
||||
0x0c067fff81f0: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
|
||||
0x0c067fff8200: fd fd fd fa fa fa fd fd fd fd fa fa 00 00 00 fa
|
||||
0x0c067fff8210: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
||||
=>0x0c067fff8220: fd fa fa fa fd fd fd fa fa fa 00 00 00[fa]fa fa
|
||||
0x0c067fff8230: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8240: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8260: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8270: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
==26009==ABORTING
|
||||
|
||||
Now the proper fix for this would be to convert both functions to return
|
||||
an `size_t` instead of an `int`. But given that this commit may be part
|
||||
of a security release, let's instead do the minimal viable fix and die
|
||||
in case we see an overflow.
|
||||
|
||||
Add a test that would have previously caused us to crash.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/937b71cc8b5b998963a7f9a33312ba3549d55510]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/t4205-log-pretty-formats.sh | 8 ++++++++
|
||||
utf8.c | 12 +++++++++---
|
||||
2 files changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 261a6f0..de15007 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -843,4 +843,12 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit mes
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message does not cause allocation failure' '
|
||||
+ test_must_fail git log -1 --format="%<(1)%B" $huge_commit 2>error &&
|
||||
+ cat >expect <<-EOF &&
|
||||
+ fatal: number too large to represent as int on this platform: 2147483649
|
||||
+ EOF
|
||||
+ test_cmp expect error
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index 6632bd2..03be475 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -208,11 +208,12 @@ int utf8_width(const char **start, size_t *remainder_p)
|
||||
*/
|
||||
int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
{
|
||||
- int width = 0;
|
||||
const char *orig = string;
|
||||
+ size_t width = 0;
|
||||
|
||||
while (string && string < orig + len) {
|
||||
- int glyph_width, skip;
|
||||
+ int glyph_width;
|
||||
+ size_t skip;
|
||||
|
||||
while (skip_ansi &&
|
||||
(skip = display_mode_esc_sequence_len(string)) != 0)
|
||||
@@ -222,7 +223,12 @@ int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
if (glyph_width > 0)
|
||||
width += glyph_width;
|
||||
}
|
||||
- return string ? width : len;
|
||||
+
|
||||
+ /*
|
||||
+ * TODO: fix the interface of this function and `utf8_strwidth()` to
|
||||
+ * return `size_t` instead of `int`.
|
||||
+ */
|
||||
+ return cast_size_t_to_int(string ? width : len);
|
||||
}
|
||||
|
||||
int utf8_strwidth(const char *string)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
99
meta/recipes-devtools/git/files/CVE-2022-41903-10.patch
Normal file
99
meta/recipes-devtools/git/files/CVE-2022-41903-10.patch
Normal file
@@ -0,0 +1,99 @@
|
||||
From 81c2d4c3a5ba0e6ab8c348708441fed170e63a82 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:10 +0100
|
||||
Subject: [PATCH 10/12] utf8: fix checking for glyph width in strbuf_utf8_replace()
|
||||
|
||||
In `strbuf_utf8_replace()`, we call `utf8_width()` to compute the width
|
||||
of the current glyph. If the glyph is a control character though it can
|
||||
be that `utf8_width()` returns `-1`, but because we assign this value to
|
||||
a `size_t` the conversion will cause us to underflow. This bug can
|
||||
easily be triggered with the following command:
|
||||
|
||||
$ git log --pretty='format:xxx%<|(1,trunc)%x10'
|
||||
|
||||
>From all I can see though this seems to be a benign underflow that has
|
||||
no security-related consequences.
|
||||
|
||||
Fix the bug by using an `int` instead. When we see a control character,
|
||||
we now copy it into the target buffer but don't advance the current
|
||||
width of the string.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/81c2d4c3a5ba0e6ab8c348708441fed170e63a82]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/t4205-log-pretty-formats.sh | 7 +++++++
|
||||
utf8.c | 19 ++++++++++++++-----
|
||||
2 files changed, 21 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index de15007..52c8bc8 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -826,6 +826,13 @@ test_expect_success 'log --pretty with padding and preceding control chars' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty truncation with control chars' '
|
||||
+ test_commit "$(printf "\20\20\20\20xxxx")" file contents commit-with-control-chars &&
|
||||
+ printf "\20\20\20\20x.." >expect &&
|
||||
+ git log -1 --pretty="format:%<(3,trunc)%s" commit-with-control-chars >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index 03be475..ec03e69 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -377,6 +377,7 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
dst = sb_dst.buf;
|
||||
|
||||
while (src < end) {
|
||||
+ int glyph_width;
|
||||
char *old;
|
||||
size_t n;
|
||||
|
||||
@@ -390,21 +391,29 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
break;
|
||||
|
||||
old = src;
|
||||
- n = utf8_width((const char**)&src, NULL);
|
||||
- if (!src) /* broken utf-8, do nothing */
|
||||
+ glyph_width = utf8_width((const char**)&src, NULL);
|
||||
+ if (!src) /* broken utf-8, do nothing */
|
||||
goto out;
|
||||
- if (n && w >= pos && w < pos + width) {
|
||||
+
|
||||
+ /*
|
||||
+ * In case we see a control character we copy it into the
|
||||
+ * buffer, but don't add it to the width.
|
||||
+ */
|
||||
+ if (glyph_width < 0)
|
||||
+ glyph_width = 0;
|
||||
+
|
||||
+ if (glyph_width && w >= pos && w < pos + width) {
|
||||
if (subst) {
|
||||
memcpy(dst, subst, subst_len);
|
||||
dst += subst_len;
|
||||
subst = NULL;
|
||||
}
|
||||
- w += n;
|
||||
+ w += glyph_width;
|
||||
continue;
|
||||
}
|
||||
memcpy(dst, old, src - old);
|
||||
dst += src - old;
|
||||
- w += n;
|
||||
+ w += glyph_width;
|
||||
}
|
||||
strbuf_setlen(&sb_dst, dst - sb_dst.buf);
|
||||
strbuf_swap(sb_src, &sb_dst);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
90
meta/recipes-devtools/git/files/CVE-2022-41903-11.patch
Normal file
90
meta/recipes-devtools/git/files/CVE-2022-41903-11.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From f930a2394303b902e2973f4308f96529f736b8bc Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:15 +0100
|
||||
Subject: [PATCH 11/12] utf8: refactor strbuf_utf8_replace to not rely on preallocated buffer
|
||||
|
||||
In `strbuf_utf8_replace`, we preallocate the destination buffer and then
|
||||
use `memcpy` to copy bytes into it at computed offsets. This feels
|
||||
rather fragile and is hard to understand at times. Refactor the code to
|
||||
instead use `strbuf_add` and `strbuf_addstr` so that we can be sure that
|
||||
there is no possibility to perform an out-of-bounds write.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/f930a2394303b902e2973f4308f96529f736b8bc]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
utf8.c | 34 +++++++++++++---------------------
|
||||
1 file changed, 13 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index ec03e69..a13f5e3 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -365,26 +365,20 @@ void strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len,
|
||||
void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
const char *subst)
|
||||
{
|
||||
- struct strbuf sb_dst = STRBUF_INIT;
|
||||
- char *src = sb_src->buf;
|
||||
- char *end = src + sb_src->len;
|
||||
- char *dst;
|
||||
- int w = 0, subst_len = 0;
|
||||
+ const char *src = sb_src->buf, *end = sb_src->buf + sb_src->len;
|
||||
+ struct strbuf dst;
|
||||
+ int w = 0;
|
||||
|
||||
- if (subst)
|
||||
- subst_len = strlen(subst);
|
||||
- strbuf_grow(&sb_dst, sb_src->len + subst_len);
|
||||
- dst = sb_dst.buf;
|
||||
+ strbuf_init(&dst, sb_src->len);
|
||||
|
||||
while (src < end) {
|
||||
+ const char *old;
|
||||
int glyph_width;
|
||||
- char *old;
|
||||
size_t n;
|
||||
|
||||
while ((n = display_mode_esc_sequence_len(src))) {
|
||||
- memcpy(dst, src, n);
|
||||
+ strbuf_add(&dst, src, n);
|
||||
src += n;
|
||||
- dst += n;
|
||||
}
|
||||
|
||||
if (src >= end)
|
||||
@@ -404,21 +398,19 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
|
||||
if (glyph_width && w >= pos && w < pos + width) {
|
||||
if (subst) {
|
||||
- memcpy(dst, subst, subst_len);
|
||||
- dst += subst_len;
|
||||
+ strbuf_addstr(&dst, subst);
|
||||
subst = NULL;
|
||||
}
|
||||
- w += glyph_width;
|
||||
- continue;
|
||||
+ } else {
|
||||
+ strbuf_add(&dst, old, src - old);
|
||||
}
|
||||
- memcpy(dst, old, src - old);
|
||||
- dst += src - old;
|
||||
+
|
||||
w += glyph_width;
|
||||
}
|
||||
- strbuf_setlen(&sb_dst, dst - sb_dst.buf);
|
||||
- strbuf_swap(sb_src, &sb_dst);
|
||||
+
|
||||
+ strbuf_swap(sb_src, &dst);
|
||||
out:
|
||||
- strbuf_release(&sb_dst);
|
||||
+ strbuf_release(&dst);
|
||||
}
|
||||
|
||||
/*
|
||||
--
|
||||
2.25.1
|
||||
|
||||
124
meta/recipes-devtools/git/files/CVE-2022-41903-12.patch
Normal file
124
meta/recipes-devtools/git/files/CVE-2022-41903-12.patch
Normal file
@@ -0,0 +1,124 @@
|
||||
From 304a50adff6480ede46b68f7545baab542cbfb46 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:23 +0100
|
||||
Subject: [PATCH 12/12] pretty: restrict input lengths for padding and wrapping formats
|
||||
|
||||
Both the padding and wrapping formatting directives allow the caller to
|
||||
specify an integer that ultimately leads to us adding this many chars to
|
||||
the result buffer. As a consequence, it is trivial to e.g. allocate 2GB
|
||||
of RAM via a single formatting directive and cause resource exhaustion
|
||||
on the machine executing this logic. Furthermore, it is debatable
|
||||
whether there are any sane usecases that require the user to pad data to
|
||||
2GB boundaries or to indent wrapped data by 2GB.
|
||||
|
||||
Restrict the input sizes to 16 kilobytes at a maximum to limit the
|
||||
amount of bytes that can be requested by the user. This is not meant
|
||||
as a fix because there are ways to trivially amplify the amount of
|
||||
data we generate via formatting directives; the real protection is
|
||||
achieved by the changes in previous steps to catch and avoid integer
|
||||
wraparound that causes us to under-allocate and access beyond the
|
||||
end of allocated memory reagions. But having such a limit
|
||||
significantly helps fuzzing the pretty format, because the fuzzer is
|
||||
otherwise quite fast to run out-of-memory as it discovers these
|
||||
formatters.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/304a50adff6480ede46b68f7545baab542cbfb46]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 26 ++++++++++++++++++++++++++
|
||||
t/t4205-log-pretty-formats.sh | 24 +++++++++++++++---------
|
||||
2 files changed, 41 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index c3c1443..e9687f0 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -13,6 +13,13 @@
|
||||
#include "gpg-interface.h"
|
||||
#include "trailer.h"
|
||||
|
||||
+/*
|
||||
+ * The limit for formatting directives, which enable the caller to append
|
||||
+ * arbitrarily many bytes to the formatted buffer. This includes padding
|
||||
+ * and wrapping formatters.
|
||||
+ */
|
||||
+#define FORMATTING_LIMIT (16 * 1024)
|
||||
+
|
||||
static char *user_format;
|
||||
static struct cmt_fmt_map {
|
||||
const char *name;
|
||||
@@ -1029,6 +1036,15 @@ static size_t parse_padding_placeholder(const char *placeholder,
|
||||
if (!*end || end == start)
|
||||
return 0;
|
||||
width = strtol(start, &next, 10);
|
||||
+
|
||||
+ /*
|
||||
+ * We need to limit the amount of padding, or otherwise this
|
||||
+ * would allow the user to pad the buffer by arbitrarily many
|
||||
+ * bytes and thus cause resource exhaustion.
|
||||
+ */
|
||||
+ if (width < -FORMATTING_LIMIT || width > FORMATTING_LIMIT)
|
||||
+ return 0;
|
||||
+
|
||||
if (next == start || width == 0)
|
||||
return 0;
|
||||
if (width < 0) {
|
||||
@@ -1188,6 +1204,16 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
||||
if (*next != ')')
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * We need to limit the format here as it allows the
|
||||
+ * user to prepend arbitrarily many bytes to the buffer
|
||||
+ * when rewrapping.
|
||||
+ */
|
||||
+ if (width > FORMATTING_LIMIT ||
|
||||
+ indent1 > FORMATTING_LIMIT ||
|
||||
+ indent2 > FORMATTING_LIMIT)
|
||||
+ return 0;
|
||||
rewrap_message_tail(sb, c, width, indent1, indent2);
|
||||
return end - placeholder + 1;
|
||||
} else
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 52c8bc8..572d02f 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -809,15 +809,21 @@ test_expect_success 'log --pretty with magical wrapping directives' '
|
||||
'
|
||||
|
||||
test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing wrapping directive' '
|
||||
- cat >expect <<-EOF &&
|
||||
- fatal: number too large to represent as int on this platform: 2147483649
|
||||
- EOF
|
||||
- test_must_fail git log -1 --pretty="format:%w(2147483649,1,1)%d" 2>error &&
|
||||
- test_cmp expect error &&
|
||||
- test_must_fail git log -1 --pretty="format:%w(1,2147483649,1)%d" 2>error &&
|
||||
- test_cmp expect error &&
|
||||
- test_must_fail git log -1 --pretty="format:%w(1,1,2147483649)%d" 2>error &&
|
||||
- test_cmp expect error
|
||||
+ printf "%%w(2147483649,1,1)0" >expect &&
|
||||
+ git log -1 --pretty="format:%w(2147483649,1,1)%x30" >actual &&
|
||||
+ test_cmp expect actual &&
|
||||
+ printf "%%w(1,2147483649,1)0" >expect &&
|
||||
+ git log -1 --pretty="format:%w(1,2147483649,1)%x30" >actual &&
|
||||
+ test_cmp expect actual &&
|
||||
+ printf "%%w(1,1,2147483649)0" >expect &&
|
||||
+ git log -1 --pretty="format:%w(1,1,2147483649)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing padding directive' '
|
||||
+ printf "%%<(2147483649)0" >expect &&
|
||||
+ git log -1 --pretty="format:%<(2147483649)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'log --pretty with padding and preceding control chars' '
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -11,8 +11,20 @@ SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
|
||||
${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages \
|
||||
file://fixsort.patch \
|
||||
file://CVE-2021-40330.patch \
|
||||
file://CVE-2022-23521.patch \
|
||||
file://CVE-2022-41903-01.patch \
|
||||
file://CVE-2022-41903-02.patch \
|
||||
file://CVE-2022-41903-03.patch \
|
||||
file://CVE-2022-41903-04.patch \
|
||||
file://CVE-2022-41903-05.patch \
|
||||
file://CVE-2022-41903-06.patch \
|
||||
file://CVE-2022-41903-07.patch \
|
||||
file://CVE-2022-41903-08.patch \
|
||||
file://CVE-2022-41903-09.patch \
|
||||
file://CVE-2022-41903-10.patch \
|
||||
file://CVE-2022-41903-11.patch \
|
||||
file://CVE-2022-41903-12.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git-${PV}"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=7c0d7ef03a7eb04ce795b0f60e68e7e1"
|
||||
@@ -23,6 +35,8 @@ CVE_PRODUCT = "git-scm:git"
|
||||
# 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_WHITELIST += "CVE-2022-24975"
|
||||
# This is specific to Git-for-Windows
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-41953"
|
||||
|
||||
PACKAGECONFIG ??= ""
|
||||
PACKAGECONFIG[cvsserver] = ""
|
||||
|
||||
@@ -7,8 +7,8 @@ export CGO_ENABLED_riscv64 = ""
|
||||
# windows/mips/riscv doesn't support -buildmode=pie, so skip the QA checking
|
||||
# for windows/mips/riscv and their variants.
|
||||
python() {
|
||||
if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True) or 'windows' in d.getVar('TARGET_GOOS', True):
|
||||
d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel")
|
||||
if 'mips' in d.getVar('TARGET_ARCH') or 'riscv' in d.getVar('TARGET_ARCH') or 'windows' in d.getVar('TARGET_GOOS'):
|
||||
d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
|
||||
else:
|
||||
d.setVar('GOBUILDMODE', 'pie')
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native"
|
||||
|
||||
EXTRA_OECONF_append = " --target-list=${@get_qemu_system_target_list(d)}"
|
||||
|
||||
PACKAGECONFIG ??= "fdt alsa kvm"
|
||||
PACKAGECONFIG ??= "fdt alsa kvm slirp"
|
||||
|
||||
# Handle distros such as CentOS 5 32-bit that do not have kvm support
|
||||
PACKAGECONFIG_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}"
|
||||
|
||||
@@ -115,6 +115,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://CVE-2021-3638.patch \
|
||||
file://CVE-2021-20196.patch \
|
||||
file://CVE-2021-3507.patch \
|
||||
file://CVE-2021-3929.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
@@ -279,6 +280,8 @@ PACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone"
|
||||
PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs"
|
||||
PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi"
|
||||
PACKAGECONFIG[vde] = "--enable-vde,--disable-vde"
|
||||
# version 4.2.0 doesn't have an "internal" option for enable-slirp, so use "git" which uses the same configure code path
|
||||
PACKAGECONFIG[slirp] = "--enable-slirp=git,--disable-slirp"
|
||||
PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd"
|
||||
PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma"
|
||||
|
||||
|
||||
78
meta/recipes-devtools/qemu/qemu/CVE-2021-3929.patch
Normal file
78
meta/recipes-devtools/qemu/qemu/CVE-2021-3929.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
From 736b01642d85be832385063f278fe7cd4ffb5221 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Jensen <k.jensen@samsung.com>
|
||||
Date: Fri, 17 Dec 2021 10:44:01 +0100
|
||||
Subject: [PATCH] hw/nvme: fix CVE-2021-3929
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes CVE-2021-3929 "locally" by denying DMA to the iomem of the
|
||||
device itself. This still allows DMA to MMIO regions of other devices
|
||||
(e.g. doing P2P DMA to the controller memory buffer of another NVMe
|
||||
device).
|
||||
|
||||
Fixes: CVE-2021-3929
|
||||
Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
|
||||
Reviewed-by: Keith Busch <kbusch@kernel.org>
|
||||
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
|
||||
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/736b01642d85be832385]
|
||||
CVE: CVE-2021-3929
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
hw/block/nvme.c | 23 +++++++++++++++++++++++
|
||||
hw/block/nvme.h | 1 +
|
||||
2 files changed, 24 insertions(+)
|
||||
|
||||
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
|
||||
index 12d82542..e7d0750c 100644
|
||||
--- a/hw/block/nvme.c
|
||||
+++ b/hw/block/nvme.c
|
||||
@@ -52,8 +52,31 @@
|
||||
|
||||
static void nvme_process_sq(void *opaque);
|
||||
|
||||
+static inline bool nvme_addr_is_iomem(NvmeCtrl *n, hwaddr addr)
|
||||
+{
|
||||
+ hwaddr hi, lo;
|
||||
+
|
||||
+ /*
|
||||
+ * The purpose of this check is to guard against invalid "local" access to
|
||||
+ * the iomem (i.e. controller registers). Thus, we check against the range
|
||||
+ * covered by the 'bar0' MemoryRegion since that is currently composed of
|
||||
+ * two subregions (the NVMe "MBAR" and the MSI-X table/pba). Note, however,
|
||||
+ * that if the device model is ever changed to allow the CMB to be located
|
||||
+ * in BAR0 as well, then this must be changed.
|
||||
+ */
|
||||
+ lo = n->bar0.addr;
|
||||
+ hi = lo + int128_get64(n->bar0.size);
|
||||
+
|
||||
+ return addr >= lo && addr < hi;
|
||||
+}
|
||||
+
|
||||
static void nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size)
|
||||
{
|
||||
+
|
||||
+ if (nvme_addr_is_iomem(n, addr)) {
|
||||
+ return NVME_DATA_TRAS_ERROR;
|
||||
+ }
|
||||
+
|
||||
if (n->cmbsz && addr >= n->ctrl_mem.addr &&
|
||||
addr < (n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size))) {
|
||||
memcpy(buf, (void *)&n->cmbuf[addr - n->ctrl_mem.addr], size);
|
||||
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
|
||||
index 557194ee..5a2b119c 100644
|
||||
--- a/hw/block/nvme.h
|
||||
+++ b/hw/block/nvme.h
|
||||
@@ -59,6 +59,7 @@ typedef struct NvmeNamespace {
|
||||
|
||||
typedef struct NvmeCtrl {
|
||||
PCIDevice parent_obj;
|
||||
+ MemoryRegion bar0;
|
||||
MemoryRegion iomem;
|
||||
MemoryRegion ctrl_mem;
|
||||
NvmeBar bar;
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -24,8 +24,8 @@ do_install_append_class-nativesdk() {
|
||||
}
|
||||
|
||||
PACKAGECONFIG ??= " \
|
||||
fdt sdl kvm \
|
||||
fdt sdl kvm slirp \
|
||||
${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
|
||||
${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \
|
||||
"
|
||||
PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
|
||||
PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm slirp"
|
||||
|
||||
@@ -12,6 +12,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
|
||||
file://Makefile \
|
||||
file://test.sh \
|
||||
file://0001-tests-Allow-different-output-from-mv.patch \
|
||||
file://faildiff-order.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-target = " file://gnu_patch_test_fix_target.patch"
|
||||
|
||||
41
meta/recipes-devtools/quilt/quilt/faildiff-order.patch
Normal file
41
meta/recipes-devtools/quilt/quilt/faildiff-order.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||
|
||||
From 4dfe7f9e702c85243a71e4de267a13e434b6d6c2 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Fri, 20 Jan 2023 12:56:08 +0100
|
||||
Subject: [PATCH] test: Fix a race condition
|
||||
|
||||
The test suite does not differentiate between stdout and stderr. When
|
||||
messages are printed to both, the order in which they will reach us
|
||||
is apparently not guaranteed. Ideally this would be deterministic, but
|
||||
until then, explicitly test stdout and stderr separately in the test
|
||||
case itself. Otherwise the test suite fails randomly, which is a pain
|
||||
for distribution package maintainers.
|
||||
|
||||
This fixes bug #63651 reported by Ross Burton:
|
||||
https://savannah.nongnu.org/bugs/index.php?63651
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
test/faildiff.test | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/faildiff.test b/test/faildiff.test
|
||||
index 5afb8e3..0444c15 100644
|
||||
--- a/test/faildiff.test
|
||||
+++ b/test/faildiff.test
|
||||
@@ -27,8 +27,9 @@ What happens on binary files?
|
||||
> File test.bin added to patch %{P}test.diff
|
||||
|
||||
$ printf "\\003\\000\\001" > test.bin
|
||||
- $ quilt diff -pab --no-index
|
||||
+ $ quilt diff -pab --no-index 2>/dev/null
|
||||
>~ (Files|Binary files) a/test\.bin and b/test\.bin differ
|
||||
+ $ quilt diff -pab --no-index >/dev/null
|
||||
> Diff failed on file 'test.bin', aborting
|
||||
$ echo %{?}
|
||||
> 1
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -9,3 +9,7 @@ BBCLASSEXTEND = "native nativesdk"
|
||||
# Severity is low and marked as closed and won't fix.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=884658
|
||||
CVE_CHECK_WHITELIST += "CVE-2013-4235"
|
||||
|
||||
# This is an issue for a different shadow
|
||||
CVE_CHECK_WHITELIST += "CVE-2016-15024"
|
||||
|
||||
|
||||
113
meta/recipes-extended/sudo/files/CVE-2023-22809.patch
Normal file
113
meta/recipes-extended/sudo/files/CVE-2023-22809.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
Backport of:
|
||||
|
||||
# HG changeset patch
|
||||
# Parent 7275148cad1f8cd3c350026460acc4d6ad349c3a
|
||||
sudoedit: do not permit editor arguments to include "--"
|
||||
We use "--" to separate the editor and arguments from the files to edit.
|
||||
If the editor arguments include "--", sudo can be tricked into allowing
|
||||
the user to edit a file not permitted by the security policy.
|
||||
Thanks to Matthieu Barjole and Victor Cutillas of Synacktiv
|
||||
(https://synacktiv.com) for finding this bug.
|
||||
|
||||
CVE: CVE-2023-22809
|
||||
Upstream-Staus: Backport [http://archive.ubuntu.com/ubuntu/pool/main/s/sudo/sudo_1.8.31-1ubuntu1.4.debian.tar.xz]
|
||||
Signed-off-by: Omkar Patil <omkar.patil@kpit.com>
|
||||
|
||||
--- a/plugins/sudoers/editor.c
|
||||
+++ b/plugins/sudoers/editor.c
|
||||
@@ -56,7 +56,7 @@ resolve_editor(const char *ed, size_t ed
|
||||
const char *cp, *ep, *tmp;
|
||||
const char *edend = ed + edlen;
|
||||
struct stat user_editor_sb;
|
||||
- int nargc;
|
||||
+ int nargc = 0;
|
||||
debug_decl(resolve_editor, SUDOERS_DEBUG_UTIL)
|
||||
|
||||
/*
|
||||
@@ -102,6 +102,21 @@ resolve_editor(const char *ed, size_t ed
|
||||
free(editor_path);
|
||||
while (nargc--)
|
||||
free(nargv[nargc]);
|
||||
+ free(nargv);
|
||||
+ debug_return_str(NULL);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * We use "--" to separate the editor and arguments from the files
|
||||
+ * to edit. The editor arguments themselves may not contain "--".
|
||||
+ */
|
||||
+ if (strcmp(nargv[nargc], "--") == 0) {
|
||||
+ sudo_warnx(U_("ignoring editor: %.*s"), (int)edlen, ed);
|
||||
+ sudo_warnx("%s", U_("editor arguments may not contain \"--\""));
|
||||
+ errno = EINVAL;
|
||||
+ free(editor_path);
|
||||
+ while (nargc--)
|
||||
+ free(nargv[nargc]);
|
||||
free(nargv);
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
--- a/plugins/sudoers/sudoers.c
|
||||
+++ b/plugins/sudoers/sudoers.c
|
||||
@@ -616,20 +616,31 @@ sudoers_policy_main(int argc, char * con
|
||||
|
||||
/* Note: must call audit before uid change. */
|
||||
if (ISSET(sudo_mode, MODE_EDIT)) {
|
||||
+ const char *env_editor = NULL;
|
||||
int edit_argc;
|
||||
- const char *env_editor;
|
||||
|
||||
free(safe_cmnd);
|
||||
safe_cmnd = find_editor(NewArgc - 1, NewArgv + 1, &edit_argc,
|
||||
&edit_argv, NULL, &env_editor, false);
|
||||
if (safe_cmnd == NULL) {
|
||||
- if (errno != ENOENT)
|
||||
+ switch (errno) {
|
||||
+ case ENOENT:
|
||||
+ audit_failure(NewArgc, NewArgv, N_("%s: command not found"),
|
||||
+ env_editor ? env_editor : def_editor);
|
||||
+ sudo_warnx(U_("%s: command not found"),
|
||||
+ env_editor ? env_editor : def_editor);
|
||||
+ goto bad;
|
||||
+ case EINVAL:
|
||||
+ if (def_env_editor && env_editor != NULL) {
|
||||
+ /* User tried to do something funny with the editor. */
|
||||
+ log_warningx(SLOG_NO_STDERR|SLOG_SEND_MAIL,
|
||||
+ "invalid user-specified editor: %s", env_editor);
|
||||
+ goto bad;
|
||||
+ }
|
||||
+ /* FALLTHROUGH */
|
||||
+ default:
|
||||
goto done;
|
||||
- audit_failure(NewArgc, NewArgv, N_("%s: command not found"),
|
||||
- env_editor ? env_editor : def_editor);
|
||||
- sudo_warnx(U_("%s: command not found"),
|
||||
- env_editor ? env_editor : def_editor);
|
||||
- goto bad;
|
||||
+ }
|
||||
}
|
||||
if (audit_success(edit_argc, edit_argv) != 0 && !def_ignore_audit_errors)
|
||||
goto done;
|
||||
--- a/plugins/sudoers/visudo.c
|
||||
+++ b/plugins/sudoers/visudo.c
|
||||
@@ -308,7 +308,7 @@ static char *
|
||||
get_editor(int *editor_argc, char ***editor_argv)
|
||||
{
|
||||
char *editor_path = NULL, **whitelist = NULL;
|
||||
- const char *env_editor;
|
||||
+ const char *env_editor = NULL;
|
||||
static char *files[] = { "+1", "sudoers" };
|
||||
unsigned int whitelist_len = 0;
|
||||
debug_decl(get_editor, SUDOERS_DEBUG_UTIL)
|
||||
@@ -342,7 +342,11 @@ get_editor(int *editor_argc, char ***edi
|
||||
if (editor_path == NULL) {
|
||||
if (def_env_editor && env_editor != NULL) {
|
||||
/* We are honoring $EDITOR so this is a fatal error. */
|
||||
- sudo_fatalx(U_("specified editor (%s) doesn't exist"), env_editor);
|
||||
+ if (errno == ENOENT) {
|
||||
+ sudo_warnx(U_("specified editor (%s) doesn't exist"),
|
||||
+ env_editor);
|
||||
+ }
|
||||
+ exit(EXIT_FAILURE);
|
||||
}
|
||||
sudo_fatalx(U_("no editor found (editor path = %s)"), def_editor);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ SRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \
|
||||
file://0001-Include-sys-types.h-for-id_t-definition.patch \
|
||||
file://0001-Fix-includes-when-building-with-musl.patch \
|
||||
file://CVE-2022-43995.patch \
|
||||
file://CVE-2023-22809.patch \
|
||||
"
|
||||
|
||||
PAM_SRC_URI = "file://sudo.pam"
|
||||
|
||||
43
meta/recipes-extended/tar/tar/CVE-2022-48303.patch
Normal file
43
meta/recipes-extended/tar/tar/CVE-2022-48303.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 3da78400eafcccb97e2f2fd4b227ea40d794ede8 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Poznyakoff <gray@gnu.org>
|
||||
Date: Sat, 11 Feb 2023 11:57:39 +0200
|
||||
Subject: Fix boundary checking in base-256 decoder
|
||||
|
||||
* src/list.c (from_header): Base-256 encoding is at least 2 bytes
|
||||
long.
|
||||
|
||||
Upstream-Status: Backport [see reference below]
|
||||
CVE: CVE-2022-48303
|
||||
|
||||
Reference to upstream patch:
|
||||
https://savannah.gnu.org/bugs/?62387
|
||||
https://git.savannah.gnu.org/cgit/tar.git/patch/src/list.c?id=3da78400eafcccb97e2f2fd4b227ea40d794ede8
|
||||
|
||||
Signed-off-by: Rodolfo Quesada Zumbado <rodolfo.zumbado@windriver.com>
|
||||
Signed-off-by: Joe Slater <joe.slater@windriver.com>
|
||||
---
|
||||
src/list.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)Signed-off-by: Rodolfo Quesada Zumbado <rodolfo.zumbado@windriver.com>
|
||||
|
||||
|
||||
(limited to 'src/list.c')
|
||||
|
||||
diff --git a/src/list.c b/src/list.c
|
||||
index 9fafc42..86bcfdd 100644
|
||||
--- a/src/list.c
|
||||
+++ b/src/list.c
|
||||
@@ -881,8 +881,9 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
where++;
|
||||
}
|
||||
}
|
||||
- else if (*where == '\200' /* positive base-256 */
|
||||
- || *where == '\377' /* negative base-256 */)
|
||||
+ else if (where <= lim - 2
|
||||
+ && (*where == '\200' /* positive base-256 */
|
||||
+ || *where == '\377' /* negative base-256 */))
|
||||
{
|
||||
/* Parse base-256 output. A nonnegative number N is
|
||||
represented as (256**DIGS)/2 + N; a negative number -N is
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
|
||||
SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2 \
|
||||
file://musl_dirent.patch \
|
||||
file://CVE-2021-20193.patch \
|
||||
file://CVE-2022-48303.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "17917356fff5cb4bd3cd5a6c3e727b05"
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
From 3122c2cdc45a964efedad8953a2df67205c3e3a8 Mon Sep 17 00:00:00 2001
|
||||
From: Behdad Esfahbod <behdad@behdad.org>
|
||||
Date: Sat, 4 Dec 2021 19:50:33 -0800
|
||||
Subject: [PATCH] [buffer] Add HB_GLYPH_FLAG_UNSAFE_TO_CONCAT
|
||||
|
||||
Fixes https://github.com/harfbuzz/harfbuzz/issues/1463
|
||||
Upstream-Status: Backport from [https://github.com/harfbuzz/harfbuzz/commit/3122c2cdc45a964efedad8953a2df67205c3e3a8]
|
||||
Comment1: To backport the fix for CVE-2023-25193, add defination for HB_GLYPH_FLAG_UNSAFE_TO_CONCAT. This patch is needed along with CVE-2023-25193-pre1.patch for sucessfull porting.
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
src/hb-buffer.cc | 10 ++---
|
||||
src/hb-buffer.h | 76 ++++++++++++++++++++++++++++++------
|
||||
src/hb-buffer.hh | 33 ++++++++++------
|
||||
src/hb-ot-layout-gsubgpos.hh | 39 +++++++++++++++---
|
||||
src/hb-ot-shape.cc | 8 +---
|
||||
5 files changed, 124 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
|
||||
index 6131c86..bba5eae 100644
|
||||
--- a/src/hb-buffer.cc
|
||||
+++ b/src/hb-buffer.cc
|
||||
@@ -610,14 +610,14 @@ done:
|
||||
}
|
||||
|
||||
void
|
||||
-hb_buffer_t::unsafe_to_break_impl (unsigned int start, unsigned int end)
|
||||
+hb_buffer_t::unsafe_to_break_impl (unsigned int start, unsigned int end, hb_mask_t mask)
|
||||
{
|
||||
unsigned int cluster = (unsigned int) -1;
|
||||
cluster = _unsafe_to_break_find_min_cluster (info, start, end, cluster);
|
||||
- _unsafe_to_break_set_mask (info, start, end, cluster);
|
||||
+ _unsafe_to_break_set_mask (info, start, end, cluster, mask);
|
||||
}
|
||||
void
|
||||
-hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end)
|
||||
+hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end, hb_mask_t mask)
|
||||
{
|
||||
if (!have_output)
|
||||
{
|
||||
@@ -631,8 +631,8 @@ hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int en
|
||||
unsigned int cluster = (unsigned int) -1;
|
||||
cluster = _unsafe_to_break_find_min_cluster (out_info, start, out_len, cluster);
|
||||
cluster = _unsafe_to_break_find_min_cluster (info, idx, end, cluster);
|
||||
- _unsafe_to_break_set_mask (out_info, start, out_len, cluster);
|
||||
- _unsafe_to_break_set_mask (info, idx, end, cluster);
|
||||
+ _unsafe_to_break_set_mask (out_info, start, out_len, cluster, mask);
|
||||
+ _unsafe_to_break_set_mask (info, idx, end, cluster, mask);
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
|
||||
index d5cb746..42dc92a 100644
|
||||
--- a/src/hb-buffer.h
|
||||
+++ b/src/hb-buffer.h
|
||||
@@ -77,26 +77,76 @@ typedef struct hb_glyph_info_t
|
||||
* @HB_GLYPH_FLAG_UNSAFE_TO_BREAK: Indicates that if input text is broken at the
|
||||
* beginning of the cluster this glyph is part of,
|
||||
* then both sides need to be re-shaped, as the
|
||||
- * result might be different. On the flip side,
|
||||
- * it means that when this flag is not present,
|
||||
- * then it's safe to break the glyph-run at the
|
||||
- * beginning of this cluster, and the two sides
|
||||
- * represent the exact same result one would get
|
||||
- * if breaking input text at the beginning of
|
||||
- * this cluster and shaping the two sides
|
||||
- * separately. This can be used to optimize
|
||||
- * paragraph layout, by avoiding re-shaping
|
||||
- * of each line after line-breaking, or limiting
|
||||
- * the reshaping to a small piece around the
|
||||
- * breaking point only.
|
||||
+ * result might be different.
|
||||
+ *
|
||||
+ * On the flip side, it means that when this
|
||||
+ * flag is not present, then it is safe to break
|
||||
+ * the glyph-run at the beginning of this
|
||||
+ * cluster, and the two sides will represent the
|
||||
+ * exact same result one would get if breaking
|
||||
+ * input text at the beginning of this cluster
|
||||
+ * and shaping the two sides separately.
|
||||
+ *
|
||||
+ * This can be used to optimize paragraph
|
||||
+ * layout, by avoiding re-shaping of each line
|
||||
+ * after line-breaking.
|
||||
+ *
|
||||
+ * @HB_GLYPH_FLAG_UNSAFE_TO_CONCAT: Indicates that if input text is changed on one
|
||||
+ * side of the beginning of the cluster this glyph
|
||||
+ * is part of, then the shaping results for the
|
||||
+ * other side might change.
|
||||
+ *
|
||||
+ * Note that the absence of this flag will NOT by
|
||||
+ * itself mean that it IS safe to concat text.
|
||||
+ * Only two pieces of text both of which clear of
|
||||
+ * this flag can be concatenated safely.
|
||||
+ *
|
||||
+ * This can be used to optimize paragraph
|
||||
+ * layout, by avoiding re-shaping of each line
|
||||
+ * after line-breaking, by limiting the
|
||||
+ * reshaping to a small piece around the
|
||||
+ * breaking positin only, even if the breaking
|
||||
+ * position carries the
|
||||
+ * #HB_GLYPH_FLAG_UNSAFE_TO_BREAK or when
|
||||
+ * hyphenation or other text transformation
|
||||
+ * happens at line-break position, in the following
|
||||
+ * way:
|
||||
+ *
|
||||
+ * 1. Iterate back from the line-break position till
|
||||
+ * the the first cluster start position that is
|
||||
+ * NOT unsafe-to-concat, 2. shape the segment from
|
||||
+ * there till the end of line, 3. check whether the
|
||||
+ * resulting glyph-run also is clear of the
|
||||
+ * unsafe-to-concat at its start-of-text position;
|
||||
+ * if it is, just splice it into place and the line
|
||||
+ * is shaped; If not, move on to a position further
|
||||
+ * back that is clear of unsafe-to-concat and retry
|
||||
+ * from there, and repeat.
|
||||
+ *
|
||||
+ * At the start of next line a similar algorithm can
|
||||
+ * be implemented. A slight complication will arise,
|
||||
+ * because while our buffer API has a way to
|
||||
+ * return flags for position corresponding to
|
||||
+ * start-of-text, there is currently no position
|
||||
+ * corresponding to end-of-text. This limitation
|
||||
+ * can be alleviated by shaping more text than needed
|
||||
+ * and looking for unsafe-to-concat flag within text
|
||||
+ * clusters.
|
||||
+ *
|
||||
+ * The #HB_GLYPH_FLAG_UNSAFE_TO_BREAK flag will
|
||||
+ * always imply this flag.
|
||||
+ *
|
||||
+ * Since: REPLACEME
|
||||
+ *
|
||||
* @HB_GLYPH_FLAG_DEFINED: All the currently defined flags.
|
||||
*
|
||||
* Since: 1.5.0
|
||||
*/
|
||||
typedef enum { /*< flags >*/
|
||||
HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
|
||||
+ HB_GLYPH_FLAG_UNSAFE_TO_CONCAT = 0x00000002,
|
||||
|
||||
- HB_GLYPH_FLAG_DEFINED = 0x00000001 /* OR of all defined flags */
|
||||
+ HB_GLYPH_FLAG_DEFINED = 0x00000003 /* OR of all defined flags */
|
||||
} hb_glyph_flags_t;
|
||||
|
||||
HB_EXTERN hb_glyph_flags_t
|
||||
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
|
||||
index b5596d9..beac7b6 100644
|
||||
--- a/src/hb-buffer.hh
|
||||
+++ b/src/hb-buffer.hh
|
||||
@@ -67,8 +67,8 @@ enum hb_buffer_scratch_flags_t {
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES = 0x00000002u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u,
|
||||
- HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u,
|
||||
- HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u,
|
||||
+ HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000010u,
|
||||
+ HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS = 0x00000020u,
|
||||
|
||||
/* Reserved for complex shapers' internal use. */
|
||||
HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u,
|
||||
@@ -324,8 +324,19 @@ struct hb_buffer_t
|
||||
return;
|
||||
unsafe_to_break_impl (start, end);
|
||||
}
|
||||
- HB_INTERNAL void unsafe_to_break_impl (unsigned int start, unsigned int end);
|
||||
- HB_INTERNAL void unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end);
|
||||
+ void unsafe_to_concat (unsigned int start,
|
||||
+ unsigned int end)
|
||||
+ {
|
||||
+ if (end - start < 2)
|
||||
+ return;
|
||||
+ unsafe_to_break_impl (start, end, HB_GLYPH_FLAG_UNSAFE_TO_CONCAT);
|
||||
+ }
|
||||
+ HB_INTERNAL void unsafe_to_break_impl (unsigned int start, unsigned int end,
|
||||
+ hb_mask_t mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK | HB_GLYPH_FLAG_UNSAFE_TO_CONCAT);
|
||||
+ HB_INTERNAL void unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end,
|
||||
+ hb_mask_t mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK | HB_GLYPH_FLAG_UNSAFE_TO_CONCAT);
|
||||
+ void unsafe_to_concat_from_outbuffer (unsigned int start, unsigned int end)
|
||||
+ { unsafe_to_break_from_outbuffer (start, end, HB_GLYPH_FLAG_UNSAFE_TO_CONCAT); }
|
||||
|
||||
|
||||
/* Internal methods */
|
||||
@@ -377,12 +388,7 @@ struct hb_buffer_t
|
||||
set_cluster (hb_glyph_info_t &inf, unsigned int cluster, unsigned int mask = 0)
|
||||
{
|
||||
if (inf.cluster != cluster)
|
||||
- {
|
||||
- if (mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
|
||||
- inf.mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
- else
|
||||
- inf.mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
- }
|
||||
+ inf.mask = (inf.mask & ~HB_GLYPH_FLAG_DEFINED) | (mask & HB_GLYPH_FLAG_DEFINED);
|
||||
inf.cluster = cluster;
|
||||
}
|
||||
|
||||
@@ -398,13 +404,14 @@ struct hb_buffer_t
|
||||
void
|
||||
_unsafe_to_break_set_mask (hb_glyph_info_t *infos,
|
||||
unsigned int start, unsigned int end,
|
||||
- unsigned int cluster)
|
||||
+ unsigned int cluster,
|
||||
+ hb_mask_t mask)
|
||||
{
|
||||
for (unsigned int i = start; i < end; i++)
|
||||
if (cluster != infos[i].cluster)
|
||||
{
|
||||
- scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK;
|
||||
- infos[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
+ scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS;
|
||||
+ infos[i].mask |= mask;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
|
||||
index 579d178..a6ca456 100644
|
||||
--- a/src/hb-ot-layout-gsubgpos.hh
|
||||
+++ b/src/hb-ot-layout-gsubgpos.hh
|
||||
@@ -369,7 +369,7 @@ struct hb_ot_apply_context_t :
|
||||
may_skip (const hb_glyph_info_t &info) const
|
||||
{ return matcher.may_skip (c, info); }
|
||||
|
||||
- bool next ()
|
||||
+ bool next (unsigned *unsafe_to = nullptr)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
while (idx + num_items < end)
|
||||
@@ -392,11 +392,17 @@ struct hb_ot_apply_context_t :
|
||||
}
|
||||
|
||||
if (skip == matcher_t::SKIP_NO)
|
||||
+ {
|
||||
+ if (unsafe_to)
|
||||
+ *unsafe_to = idx + 1;
|
||||
return false;
|
||||
+ }
|
||||
}
|
||||
+ if (unsafe_to)
|
||||
+ *unsafe_to = end;
|
||||
return false;
|
||||
}
|
||||
- bool prev ()
|
||||
+ bool prev (unsigned *unsafe_from = nullptr)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
while (idx > num_items - 1)
|
||||
@@ -419,8 +425,14 @@ struct hb_ot_apply_context_t :
|
||||
}
|
||||
|
||||
if (skip == matcher_t::SKIP_NO)
|
||||
+ {
|
||||
+ if (unsafe_from)
|
||||
+ *unsafe_from = hb_max (1u, idx) - 1u;
|
||||
return false;
|
||||
+ }
|
||||
}
|
||||
+ if (unsafe_from)
|
||||
+ *unsafe_from = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -834,7 +846,12 @@ static inline bool match_input (hb_ot_apply_context_t *c,
|
||||
match_positions[0] = buffer->idx;
|
||||
for (unsigned int i = 1; i < count; i++)
|
||||
{
|
||||
- if (!skippy_iter.next ()) return_trace (false);
|
||||
+ unsigned unsafe_to;
|
||||
+ if (!skippy_iter.next (&unsafe_to))
|
||||
+ {
|
||||
+ c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
|
||||
match_positions[i] = skippy_iter.idx;
|
||||
|
||||
@@ -1022,8 +1039,14 @@ static inline bool match_backtrack (hb_ot_apply_context_t *c,
|
||||
skippy_iter.set_match_func (match_func, match_data, backtrack);
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
- if (!skippy_iter.prev ())
|
||||
+ {
|
||||
+ unsigned unsafe_from;
|
||||
+ if (!skippy_iter.prev (&unsafe_from))
|
||||
+ {
|
||||
+ c->buffer->unsafe_to_concat_from_outbuffer (unsafe_from, c->buffer->idx);
|
||||
return_trace (false);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
*match_start = skippy_iter.idx;
|
||||
|
||||
@@ -1045,8 +1068,14 @@ static inline bool match_lookahead (hb_ot_apply_context_t *c,
|
||||
skippy_iter.set_match_func (match_func, match_data, lookahead);
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
- if (!skippy_iter.next ())
|
||||
+ {
|
||||
+ unsigned unsafe_to;
|
||||
+ if (!skippy_iter.next (&unsafe_to))
|
||||
+ {
|
||||
+ c->buffer->unsafe_to_concat (c->buffer->idx + offset, unsafe_to);
|
||||
return_trace (false);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
*end_index = skippy_iter.idx + 1;
|
||||
|
||||
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
|
||||
index 5d9a70c..5d10b30 100644
|
||||
--- a/src/hb-ot-shape.cc
|
||||
+++ b/src/hb-ot-shape.cc
|
||||
@@ -1008,7 +1008,7 @@ hb_propagate_flags (hb_buffer_t *buffer)
|
||||
/* Propagate cluster-level glyph flags to be the same on all cluster glyphs.
|
||||
* Simplifies using them. */
|
||||
|
||||
- if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK))
|
||||
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS))
|
||||
return;
|
||||
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
@@ -1017,11 +1017,7 @@ hb_propagate_flags (hb_buffer_t *buffer)
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
for (unsigned int i = start; i < end; i++)
|
||||
- if (info[i].mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
|
||||
- {
|
||||
- mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
- break;
|
||||
- }
|
||||
+ mask |= info[i].mask & HB_GLYPH_FLAG_DEFINED;
|
||||
if (mask)
|
||||
for (unsigned int i = start; i < end; i++)
|
||||
info[i].mask |= mask;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
From b29fbd16fa82b82bdf0dcb2f13a63f7dc23cf324 Mon Sep 17 00:00:00 2001
|
||||
From: Behdad Esfahbod <behdad@behdad.org>
|
||||
Date: Mon, 6 Feb 2023 13:08:52 -0700
|
||||
Subject: [PATCH] [gsubgpos] Refactor skippy_iter.match()
|
||||
|
||||
Upstream-Status: Backport from [https://github.com/harfbuzz/harfbuzz/commit/b29fbd16fa82b82bdf0dcb2f13a63f7dc23cf324]
|
||||
Comment1: To backport the fix for CVE-2023-25193, add defination for MATCH, NOT_MATCH and SKIP.
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
src/hb-ot-layout-gsubgpos.hh | 94 +++++++++++++++++++++---------------
|
||||
1 file changed, 54 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
|
||||
index a6ca456..5a7e564 100644
|
||||
--- a/src/hb-ot-layout-gsubgpos.hh
|
||||
+++ b/src/hb-ot-layout-gsubgpos.hh
|
||||
@@ -369,33 +369,52 @@ struct hb_ot_apply_context_t :
|
||||
may_skip (const hb_glyph_info_t &info) const
|
||||
{ return matcher.may_skip (c, info); }
|
||||
|
||||
+ enum match_t {
|
||||
+ MATCH,
|
||||
+ NOT_MATCH,
|
||||
+ SKIP
|
||||
+ };
|
||||
+
|
||||
+ match_t match (hb_glyph_info_t &info)
|
||||
+ {
|
||||
+ matcher_t::may_skip_t skip = matcher.may_skip (c, info);
|
||||
+ if (unlikely (skip == matcher_t::SKIP_YES))
|
||||
+ return SKIP;
|
||||
+
|
||||
+ matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
|
||||
+ if (match == matcher_t::MATCH_YES ||
|
||||
+ (match == matcher_t::MATCH_MAYBE &&
|
||||
+ skip == matcher_t::SKIP_NO))
|
||||
+ return MATCH;
|
||||
+
|
||||
+ if (skip == matcher_t::SKIP_NO)
|
||||
+ return NOT_MATCH;
|
||||
+
|
||||
+ return SKIP;
|
||||
+ }
|
||||
+
|
||||
bool next (unsigned *unsafe_to = nullptr)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
while (idx + num_items < end)
|
||||
{
|
||||
idx++;
|
||||
- const hb_glyph_info_t &info = c->buffer->info[idx];
|
||||
-
|
||||
- matcher_t::may_skip_t skip = matcher.may_skip (c, info);
|
||||
- if (unlikely (skip == matcher_t::SKIP_YES))
|
||||
- continue;
|
||||
-
|
||||
- matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
|
||||
- if (match == matcher_t::MATCH_YES ||
|
||||
- (match == matcher_t::MATCH_MAYBE &&
|
||||
- skip == matcher_t::SKIP_NO))
|
||||
- {
|
||||
- num_items--;
|
||||
- if (match_glyph_data) match_glyph_data++;
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- if (skip == matcher_t::SKIP_NO)
|
||||
+ switch (match (c->buffer->info[idx]))
|
||||
{
|
||||
- if (unsafe_to)
|
||||
- *unsafe_to = idx + 1;
|
||||
- return false;
|
||||
+ case MATCH:
|
||||
+ {
|
||||
+ num_items--;
|
||||
+ if (match_glyph_data) match_glyph_data++;
|
||||
+ return true;
|
||||
+ }
|
||||
+ case NOT_MATCH:
|
||||
+ {
|
||||
+ if (unsafe_to)
|
||||
+ *unsafe_to = idx + 1;
|
||||
+ return false;
|
||||
+ }
|
||||
+ case SKIP:
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
if (unsafe_to)
|
||||
@@ -408,27 +427,22 @@ struct hb_ot_apply_context_t :
|
||||
while (idx > num_items - 1)
|
||||
{
|
||||
idx--;
|
||||
- const hb_glyph_info_t &info = c->buffer->out_info[idx];
|
||||
-
|
||||
- matcher_t::may_skip_t skip = matcher.may_skip (c, info);
|
||||
- if (unlikely (skip == matcher_t::SKIP_YES))
|
||||
- continue;
|
||||
-
|
||||
- matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
|
||||
- if (match == matcher_t::MATCH_YES ||
|
||||
- (match == matcher_t::MATCH_MAYBE &&
|
||||
- skip == matcher_t::SKIP_NO))
|
||||
+ switch (match (c->buffer->out_info[idx]))
|
||||
{
|
||||
- num_items--;
|
||||
- if (match_glyph_data) match_glyph_data++;
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- if (skip == matcher_t::SKIP_NO)
|
||||
- {
|
||||
- if (unsafe_from)
|
||||
- *unsafe_from = hb_max (1u, idx) - 1u;
|
||||
- return false;
|
||||
+ case MATCH:
|
||||
+ {
|
||||
+ num_items--;
|
||||
+ if (match_glyph_data) match_glyph_data++;
|
||||
+ return true;
|
||||
+ }
|
||||
+ case NOT_MATCH:
|
||||
+ {
|
||||
+ if (unsafe_from)
|
||||
+ *unsafe_from = hb_max (1u, idx) - 1u;
|
||||
+ return false;
|
||||
+ }
|
||||
+ case SKIP:
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
if (unsafe_from)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
179
meta/recipes-graphics/harfbuzz/harfbuzz/CVE-2023-25193.patch
Normal file
179
meta/recipes-graphics/harfbuzz/harfbuzz/CVE-2023-25193.patch
Normal file
@@ -0,0 +1,179 @@
|
||||
From 8708b9e081192786c027bb7f5f23d76dbe5c19e8 Mon Sep 17 00:00:00 2001
|
||||
From: Behdad Esfahbod <behdad@behdad.org>
|
||||
Date: Mon, 6 Feb 2023 14:51:25 -0700
|
||||
Subject: [PATCH] [GPOS] Avoid O(n^2) behavior in mark-attachment
|
||||
|
||||
Upstream-Status: Backport from [https://github.com/harfbuzz/harfbuzz/commit/8708b9e081192786c027bb7f5f23d76dbe5c19e8]
|
||||
Comment1: The Original Patch [https://github.com/harfbuzz/harfbuzz/commit/85be877925ddbf34f74a1229f3ca1716bb6170dc] causes regression and was reverted. This Patch completes the fix.
|
||||
Comment2: The Patch contained files MarkBasePosFormat1.hh and MarkLigPosFormat1.hh which were moved from hb-ot-layout-gpos-table.hh as per https://github.com/harfbuzz/harfbuzz/commit/197d9a5c994eb41c8c89b7b958b26b1eacfeeb00
|
||||
CVE: CVE-2023-25193
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
src/hb-ot-layout-gpos-table.hh | 101 ++++++++++++++++++++++++---------
|
||||
src/hb-ot-layout-gsubgpos.hh | 5 +-
|
||||
2 files changed, 77 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
|
||||
index 024312d..88df13d 100644
|
||||
--- a/src/hb-ot-layout-gpos-table.hh
|
||||
+++ b/src/hb-ot-layout-gpos-table.hh
|
||||
@@ -1458,6 +1458,25 @@ struct MarkBasePosFormat1
|
||||
|
||||
const Coverage &get_coverage () const { return this+markCoverage; }
|
||||
|
||||
+ static inline bool accept (hb_buffer_t *buffer, unsigned idx)
|
||||
+ {
|
||||
+ /* We only want to attach to the first of a MultipleSubst sequence.
|
||||
+ * https://github.com/harfbuzz/harfbuzz/issues/740
|
||||
+ * Reject others...
|
||||
+ * ...but stop if we find a mark in the MultipleSubst sequence:
|
||||
+ * https://github.com/harfbuzz/harfbuzz/issues/1020 */
|
||||
+ return !_hb_glyph_info_multiplied (&buffer->info[idx]) ||
|
||||
+ 0 == _hb_glyph_info_get_lig_comp (&buffer->info[idx]) ||
|
||||
+ (idx == 0 ||
|
||||
+ _hb_glyph_info_is_mark (&buffer->info[idx - 1]) ||
|
||||
+ !_hb_glyph_info_multiplied (&buffer->info[idx - 1]) ||
|
||||
+ _hb_glyph_info_get_lig_id (&buffer->info[idx]) !=
|
||||
+ _hb_glyph_info_get_lig_id (&buffer->info[idx - 1]) ||
|
||||
+ _hb_glyph_info_get_lig_comp (&buffer->info[idx]) !=
|
||||
+ _hb_glyph_info_get_lig_comp (&buffer->info[idx - 1]) + 1
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
bool apply (hb_ot_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY (this);
|
||||
@@ -1465,37 +1484,46 @@ struct MarkBasePosFormat1
|
||||
unsigned int mark_index = (this+markCoverage).get_coverage (buffer->cur().codepoint);
|
||||
if (likely (mark_index == NOT_COVERED)) return_trace (false);
|
||||
|
||||
- /* Now we search backwards for a non-mark glyph */
|
||||
+ /* Now we search backwards for a non-mark glyph.
|
||||
+ * We don't use skippy_iter.prev() to avoid O(n^2) behavior. */
|
||||
+
|
||||
hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
|
||||
- skippy_iter.reset (buffer->idx, 1);
|
||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||
- do {
|
||||
- if (!skippy_iter.prev ()) return_trace (false);
|
||||
- /* We only want to attach to the first of a MultipleSubst sequence.
|
||||
- * https://github.com/harfbuzz/harfbuzz/issues/740
|
||||
- * Reject others...
|
||||
- * ...but stop if we find a mark in the MultipleSubst sequence:
|
||||
- * https://github.com/harfbuzz/harfbuzz/issues/1020 */
|
||||
- if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
|
||||
- 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) ||
|
||||
- (skippy_iter.idx == 0 ||
|
||||
- _hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx - 1]) ||
|
||||
- _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]) !=
|
||||
- _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) ||
|
||||
- _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=
|
||||
- _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx - 1]) + 1
|
||||
- ))
|
||||
- break;
|
||||
- skippy_iter.reject ();
|
||||
- } while (true);
|
||||
+ unsigned j;
|
||||
+ for (j = buffer->idx; j > c->last_base_until; j--)
|
||||
+ {
|
||||
+ auto match = skippy_iter.match (buffer->info[j - 1]);
|
||||
+ if (match == skippy_iter.MATCH)
|
||||
+ {
|
||||
+ if (!accept (buffer, j - 1))
|
||||
+ match = skippy_iter.SKIP;
|
||||
+ }
|
||||
+ if (match == skippy_iter.MATCH)
|
||||
+ {
|
||||
+ c->last_base = (signed) j - 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ c->last_base_until = buffer->idx;
|
||||
+ if (c->last_base == -1)
|
||||
+ {
|
||||
+ buffer->unsafe_to_concat_from_outbuffer (0, buffer->idx + 1);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
+
|
||||
+ unsigned idx = (unsigned) c->last_base;
|
||||
|
||||
/* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
|
||||
- //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
|
||||
+ //if (!_hb_glyph_info_is_base_glyph (&buffer->info[idx])) { return_trace (false); }
|
||||
|
||||
- unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[skippy_iter.idx].codepoint);
|
||||
+ unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[idx].codepoint);
|
||||
if (base_index == NOT_COVERED) return_trace (false);
|
||||
+ {
|
||||
+ buffer->unsafe_to_concat_from_outbuffer (idx, buffer->idx + 1);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
|
||||
- return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx));
|
||||
+ return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, idx));
|
||||
}
|
||||
|
||||
bool subset (hb_subset_context_t *c) const
|
||||
@@ -1587,15 +1615,32 @@ struct MarkLigPosFormat1
|
||||
if (likely (mark_index == NOT_COVERED)) return_trace (false);
|
||||
|
||||
/* Now we search backwards for a non-mark glyph */
|
||||
+
|
||||
hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
|
||||
- skippy_iter.reset (buffer->idx, 1);
|
||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||
- if (!skippy_iter.prev ()) return_trace (false);
|
||||
+
|
||||
+ unsigned j;
|
||||
+ for (j = buffer->idx; j > c->last_base_until; j--)
|
||||
+ {
|
||||
+ auto match = skippy_iter.match (buffer->info[j - 1]);
|
||||
+ if (match == skippy_iter.MATCH)
|
||||
+ {
|
||||
+ c->last_base = (signed) j - 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ c->last_base_until = buffer->idx;
|
||||
+ if (c->last_base == -1)
|
||||
+ {
|
||||
+ buffer->unsafe_to_concat_from_outbuffer (0, buffer->idx + 1);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
+
|
||||
+ j = (unsigned) c->last_base;
|
||||
|
||||
/* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
|
||||
- //if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { return_trace (false); }
|
||||
+ //if (!_hb_glyph_info_is_ligature (&buffer->info[idx])) { return_trace (false); }
|
||||
|
||||
- unsigned int j = skippy_iter.idx;
|
||||
unsigned int lig_index = (this+ligatureCoverage).get_coverage (buffer->info[j].codepoint);
|
||||
if (lig_index == NOT_COVERED) return_trace (false);
|
||||
|
||||
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
|
||||
index 5a7e564..437123c 100644
|
||||
--- a/src/hb-ot-layout-gsubgpos.hh
|
||||
+++ b/src/hb-ot-layout-gsubgpos.hh
|
||||
@@ -503,6 +503,9 @@ struct hb_ot_apply_context_t :
|
||||
uint32_t random_state;
|
||||
|
||||
|
||||
+ signed last_base = -1; // GPOS uses
|
||||
+ unsigned last_base_until = 0; // GPOS uses
|
||||
+
|
||||
hb_ot_apply_context_t (unsigned int table_index_,
|
||||
hb_font_t *font_,
|
||||
hb_buffer_t *buffer_) :
|
||||
@@ -536,7 +539,7 @@ struct hb_ot_apply_context_t :
|
||||
iter_context.init (this, true);
|
||||
}
|
||||
|
||||
- void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; init_iters (); }
|
||||
+ void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; last_base = -1; last_base_until = 0; init_iters (); }
|
||||
void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; init_iters (); }
|
||||
void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; init_iters (); }
|
||||
void set_random (bool random_) { random = random_; }
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -7,7 +7,10 @@ LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=e11f5c3149cdec4bb309babb020b32b9 \
|
||||
file://src/hb-ucd.cc;beginline=1;endline=15;md5=29d4dcb6410429195df67efe3382d8bc"
|
||||
|
||||
SRC_URI = "http://www.freedesktop.org/software/harfbuzz/release/${BP}.tar.xz"
|
||||
SRC_URI = "http://www.freedesktop.org/software/harfbuzz/release/${BP}.tar.xz \
|
||||
file://CVE-2023-25193-pre0.patch \
|
||||
file://CVE-2023-25193-pre1.patch \
|
||||
file://CVE-2023-25193.patch"
|
||||
SRC_URI[md5sum] = "2b3a4dfdb3e5e50055f941978944da9f"
|
||||
SRC_URI[sha256sum] = "9413b8d96132d699687ef914ebb8c50440efc87b3f775d25856d7ec347c03c12"
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ LICENSE = "\
|
||||
& Firmware-phanfw \
|
||||
& Firmware-qat \
|
||||
& Firmware-qcom \
|
||||
& Firmware-qcom-yamato \
|
||||
& Firmware-qla1280 \
|
||||
& Firmware-qla2xxx \
|
||||
& Firmware-qualcommAthos_ar3k \
|
||||
@@ -70,7 +71,7 @@ LICENSE = "\
|
||||
LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \
|
||||
file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \
|
||||
file://LICENSE.amdgpu;md5=44c1166d052226cb2d6c8d7400090203 \
|
||||
file://LICENSE.amdgpu;md5=a2589a05ea5b6bd2b7f4f623c7e7a649 \
|
||||
file://LICENSE.amd-ucode;md5=6ca90c57f7b248de1e25c7f68ffc4698 \
|
||||
file://LICENSE.amlogic_vdec;md5=dc44f59bf64a81643e500ad3f39a468a \
|
||||
file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \
|
||||
@@ -109,6 +110,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.phanfw;md5=954dcec0e051f9409812b561ea743bfa \
|
||||
file://LICENCE.qat_firmware;md5=9e7d8bea77612d7cc7d9e9b54b623062 \
|
||||
file://LICENSE.qcom;md5=164e3362a538eb11d3ac51e8e134294b \
|
||||
file://LICENSE.qcom_yamato;md5=d0de0eeccaf1843a850bf7a6777eec5c \
|
||||
file://LICENCE.qla1280;md5=d6895732e622d950609093223a2c4f5d \
|
||||
file://LICENCE.qla2xxx;md5=505855e921b75f1be4a437ad9b79dff0 \
|
||||
file://LICENSE.QualcommAtheros_ar3k;md5=b5fe244fb2b532311de1472a3bc06da5 \
|
||||
@@ -132,7 +134,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
"
|
||||
# WHENCE checksum is defined separately to ease overriding it if
|
||||
# class-devupstream is selected.
|
||||
WHENCE_CHKSUM = "bf7c716d16e48fe118c6209f99b13253"
|
||||
WHENCE_CHKSUM = "aadb3cccbde1e53fc244a409e9bd5a22"
|
||||
|
||||
# These are not common licenses, set NO_GENERIC_LICENSE for them
|
||||
# so that the license files will be copied from fetched source
|
||||
@@ -177,6 +179,7 @@ NO_GENERIC_LICENSE[Firmware-ath9k-htc] = "LICENCE.open-ath9k-htc-firmware"
|
||||
NO_GENERIC_LICENSE[Firmware-phanfw] = "LICENCE.phanfw"
|
||||
NO_GENERIC_LICENSE[Firmware-qat] = "LICENCE.qat_firmware"
|
||||
NO_GENERIC_LICENSE[Firmware-qcom] = "LICENSE.qcom"
|
||||
NO_GENERIC_LICENSE[Firmware-qcom-yamato] = "LICENSE.qcom_yamato"
|
||||
NO_GENERIC_LICENSE[Firmware-qla1280] = "LICENCE.qla1280"
|
||||
NO_GENERIC_LICENSE[Firmware-qla2xxx] = "LICENCE.qla2xxx"
|
||||
NO_GENERIC_LICENSE[Firmware-qualcommAthos_ar3k] = "LICENSE.QualcommAtheros_ar3k"
|
||||
@@ -209,7 +212,7 @@ SRC_URI:class-devupstream = "git://git.kernel.org/pub/scm/linux/kernel/git/firmw
|
||||
# Pin this to the 20220509 release, override this in local.conf
|
||||
SRCREV:class-devupstream ?= "b19cbdca78ab2adfd210c91be15a22568e8b8cae"
|
||||
|
||||
SRC_URI[sha256sum] = "e793783e92acbde549965521462d1d1327827360664cf242dbda08f075654331"
|
||||
SRC_URI[sha256sum] = "6e3d9e8d52cffc4ec0dbe8533a8445328e0524a20f159a5b61c2706f983ce38a"
|
||||
|
||||
inherit allarch
|
||||
|
||||
@@ -305,7 +308,7 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
|
||||
${PN}-nvidia-gpu \
|
||||
${PN}-netronome-license ${PN}-netronome \
|
||||
${PN}-qat ${PN}-qat-license \
|
||||
${PN}-qcom-license \
|
||||
${PN}-qcom-license ${PN}-qcom-yamato-license \
|
||||
${PN}-qcom-venus-1.8 ${PN}-qcom-venus-4.2 ${PN}-qcom-venus-5.2 ${PN}-qcom-venus-5.4 \
|
||||
${PN}-qcom-vpu-1.0 ${PN}-qcom-vpu-2.0 \
|
||||
${PN}-qcom-adreno-a2xx ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a4xx ${PN}-qcom-adreno-a530 \
|
||||
@@ -961,14 +964,41 @@ RDEPENDS_${PN}-qat = "${PN}-qat-license"
|
||||
|
||||
# For QCOM VPU/GPU and SDM845
|
||||
LICENSE_${PN}-qcom-license = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-yamato-license = "Firmware-qcom-yamato"
|
||||
LICENSE_${PN}-qcom-venus-1.8 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-venus-4.2 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-venus-5.2 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-venus-5.4 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-vpu-1.0 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-vpu-2.0 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a2xx = "Firmware-qcom Firmware-qcom-yamato"
|
||||
LICENSE_${PN}-qcom-adreno-a3xx = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a4xx = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a530 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a630 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a650 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a660 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-apq8096-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-apq8096-modem = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-compute = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sdm845-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sdm845-compute = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sdm845-modem = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sm8250-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sm8250-compute = "Firmware-qcom"
|
||||
|
||||
FILES_${PN}-qcom-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom ${nonarch_base_libdir}/firmware/qcom/NOTICE.txt"
|
||||
FILES_${PN}-qcom-yamato-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom_yamato"
|
||||
FILES_${PN}-qcom-venus-1.8 = "${nonarch_base_libdir}/firmware/qcom/venus-1.8/*"
|
||||
FILES_${PN}-qcom-venus-4.2 = "${nonarch_base_libdir}/firmware/qcom/venus-4.2/*"
|
||||
FILES_${PN}-qcom-venus-5.2 = "${nonarch_base_libdir}/firmware/qcom/venus-5.2/*"
|
||||
FILES_${PN}-qcom-venus-5.4 = "${nonarch_base_libdir}/firmware/qcom/venus-5.4/*"
|
||||
FILES_${PN}-qcom-vpu-1.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-1.0/*"
|
||||
FILES_${PN}-qcom-vpu-2.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-2.0/*"
|
||||
FILES_${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw ${nonarch_base_libdir}/firmware/qcom/yamato_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a3xx = "${nonarch_base_libdir}/firmware/qcom/a3*_*.fw ${nonarch_base_libdir}/firmware/a300_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a4xx = "${nonarch_base_libdir}/firmware/qcom/a4*_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a530 = "${nonarch_base_libdir}/firmware/qcom/a530*.*"
|
||||
@@ -994,7 +1024,7 @@ RDEPENDS_${PN}-qcom-venus-5.4 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-vpu-1.0 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-vpu-2.0 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a2xx = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a3xx = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a2xx = "${PN}-qcom-license ${PN}-qcom-yamato-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a4xx = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a530 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a630 = "${PN}-qcom-license"
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
inherit kernel
|
||||
require recipes-kernel/linux/linux-yocto.inc
|
||||
# for ncurses tests
|
||||
inherit pkgconfig
|
||||
|
||||
# provide this .inc to set specific revisions
|
||||
include recipes-kernel/linux/linux-yocto-dev-revisions.inc
|
||||
|
||||
@@ -3,7 +3,7 @@ HOMEPAGE = "https://www.yoctoproject.org/"
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
|
||||
|
||||
inherit kernel-arch
|
||||
inherit kernel-arch linux-kernel-base
|
||||
inherit pkgconfig
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
@@ -5,7 +5,7 @@ LICENSE = "ISC"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c"
|
||||
|
||||
SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz"
|
||||
SRC_URI[sha256sum] = "59c8f7d17966db71b27f90e735ee8f5b42ca3527694a8c5e6e9b56bd379c3b84"
|
||||
SRC_URI[sha256sum] = "fe81e8a8694dc4753a45087a1c4c7e1b48dee5a59f5f796ce374ea550f0b2e73"
|
||||
|
||||
inherit bin_package allarch
|
||||
|
||||
659
meta/recipes-multimedia/libtiff/files/CVE-2022-3570_3598.patch
Normal file
659
meta/recipes-multimedia/libtiff/files/CVE-2022-3570_3598.patch
Normal file
@@ -0,0 +1,659 @@
|
||||
From 226e336cdceec933da2e9f72b6578c7a1bea450b Mon Sep 17 00:00:00 2001
|
||||
From: Su Laus <sulau@freenet.de>
|
||||
Date: Thu, 13 Oct 2022 14:33:27 +0000
|
||||
Subject: [PATCH] tiffcrop subroutines require a larger buffer (fixes #271,
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
|
||||
CVE: CVE-2022-3570 CVE-2022-3598
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/cfbb883bf6ea7bedcb04177cc4e52d304522fdff
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/24d3b2425af24432e0e4e2fd58b33f3b04c4bfa4
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Last-Update: 2023-01-17
|
||||
|
||||
#381, #386, #388, #389, #435)
|
||||
|
||||
---
|
||||
tools/tiffcrop.c | 209 ++++++++++++++++++++++++++---------------------
|
||||
1 file changed, 117 insertions(+), 92 deletions(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index c7877aa..c923920 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -126,6 +126,7 @@ static char tiffcrop_rev_date[] = "03-03-2010";
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
+# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
@@ -212,6 +213,10 @@ extern int getopt(int argc, char * const argv[], const char *optstring);
|
||||
|
||||
#define TIFF_DIR_MAX 65534
|
||||
|
||||
+/* Some conversion subroutines require image buffers, which are at least 3 bytes
|
||||
+ * larger than the necessary size for the image itself. */
|
||||
+#define NUM_BUFF_OVERSIZE_BYTES 3
|
||||
+
|
||||
/* Offsets into buffer for margins and fixed width and length segments */
|
||||
struct offset {
|
||||
uint32 tmargin;
|
||||
@@ -233,7 +238,7 @@ struct offset {
|
||||
*/
|
||||
|
||||
struct buffinfo {
|
||||
- uint32 size; /* size of this buffer */
|
||||
+ size_t size; /* size of this buffer */
|
||||
unsigned char *buffer; /* address of the allocated buffer */
|
||||
};
|
||||
|
||||
@@ -771,8 +776,8 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8* buf,
|
||||
uint32 dst_rowsize, shift_width;
|
||||
uint32 bytes_per_sample, bytes_per_pixel;
|
||||
uint32 trailing_bits, prev_trailing_bits;
|
||||
- uint32 tile_rowsize = TIFFTileRowSize(in);
|
||||
- uint32 src_offset, dst_offset;
|
||||
+ tmsize_t tile_rowsize = TIFFTileRowSize(in);
|
||||
+ tmsize_t src_offset, dst_offset;
|
||||
uint32 row_offset, col_offset;
|
||||
uint8 *bufp = (uint8*) buf;
|
||||
unsigned char *src = NULL;
|
||||
@@ -822,7 +827,7 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8* buf,
|
||||
TIFFError("readContigTilesIntoBuffer", "Integer overflow when calculating buffer size.");
|
||||
exit(-1);
|
||||
}
|
||||
- tilebuf = _TIFFmalloc(tile_buffsize + 3);
|
||||
+ tilebuf = _TIFFmalloc(tile_buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (tilebuf == 0)
|
||||
return 0;
|
||||
tilebuf[tile_buffsize] = 0;
|
||||
@@ -986,7 +991,7 @@ static int readSeparateTilesIntoBuffer (TIFF* in, uint8 *obuf,
|
||||
for (sample = 0; (sample < spp) && (sample < MAX_SAMPLES); sample++)
|
||||
{
|
||||
srcbuffs[sample] = NULL;
|
||||
- tbuff = (unsigned char *)_TIFFmalloc(tilesize + 8);
|
||||
+ tbuff = (unsigned char *)_TIFFmalloc(tilesize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!tbuff)
|
||||
{
|
||||
TIFFError ("readSeparateTilesIntoBuffer",
|
||||
@@ -1181,7 +1186,8 @@ writeBufferToSeparateStrips (TIFF* out, uint8* buf,
|
||||
}
|
||||
rowstripsize = rowsperstrip * bytes_per_sample * (width + 1);
|
||||
|
||||
- obuf = _TIFFmalloc (rowstripsize);
|
||||
+ /* Add 3 padding bytes for extractContigSamples32bits */
|
||||
+ obuf = _TIFFmalloc (rowstripsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (obuf == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -1194,7 +1200,7 @@ writeBufferToSeparateStrips (TIFF* out, uint8* buf,
|
||||
stripsize = TIFFVStripSize(out, nrows);
|
||||
src = buf + (row * rowsize);
|
||||
total_bytes += stripsize;
|
||||
- memset (obuf, '\0', rowstripsize);
|
||||
+ memset (obuf, '\0',rowstripsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (extractContigSamplesToBuffer(obuf, src, nrows, width, s, spp, bps, dump))
|
||||
{
|
||||
_TIFFfree(obuf);
|
||||
@@ -1202,10 +1208,15 @@ writeBufferToSeparateStrips (TIFF* out, uint8* buf,
|
||||
}
|
||||
if ((dump->outfile != NULL) && (dump->level == 1))
|
||||
{
|
||||
- dump_info(dump->outfile, dump->format,"",
|
||||
+ if ((uint64_t)scanlinesize > 0x0ffffffffULL) {
|
||||
+ dump_info(dump->infile, dump->format, "loadImage",
|
||||
+ "Attention: scanlinesize %"PRIu64" is larger than UINT32_MAX.\nFollowing dump might be wrong.",
|
||||
+ (uint64_t)scanlinesize);
|
||||
+ }
|
||||
+ dump_info(dump->outfile, dump->format,"",
|
||||
"Sample %2d, Strip: %2d, bytes: %4d, Row %4d, bytes: %4d, Input offset: %6d",
|
||||
- s + 1, strip + 1, stripsize, row + 1, scanlinesize, src - buf);
|
||||
- dump_buffer(dump->outfile, dump->format, nrows, scanlinesize, row, obuf);
|
||||
+ s + 1, strip + 1, stripsize, row + 1, (uint32)scanlinesize, src - buf);
|
||||
+ dump_buffer(dump->outfile, dump->format, nrows, (uint32)scanlinesize, row, obuf);
|
||||
}
|
||||
|
||||
if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0)
|
||||
@@ -1232,7 +1243,7 @@ static int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength,
|
||||
uint32 tl, tw;
|
||||
uint32 row, col, nrow, ncol;
|
||||
uint32 src_rowsize, col_offset;
|
||||
- uint32 tile_rowsize = TIFFTileRowSize(out);
|
||||
+ tmsize_t tile_rowsize = TIFFTileRowSize(out);
|
||||
uint8* bufp = (uint8*) buf;
|
||||
tsize_t tile_buffsize = 0;
|
||||
tsize_t tilesize = TIFFTileSize(out);
|
||||
@@ -1275,9 +1286,11 @@ static int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength,
|
||||
}
|
||||
src_rowsize = ((imagewidth * spp * bps) + 7U) / 8;
|
||||
|
||||
- tilebuf = _TIFFmalloc(tile_buffsize);
|
||||
+ /* Add 3 padding bytes for extractContigSamples32bits */
|
||||
+ tilebuf = _TIFFmalloc(tile_buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (tilebuf == 0)
|
||||
return 1;
|
||||
+ memset(tilebuf, 0, tile_buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
for (row = 0; row < imagelength; row += tl)
|
||||
{
|
||||
nrow = (row + tl > imagelength) ? imagelength - row : tl;
|
||||
@@ -1323,7 +1336,8 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength
|
||||
uint32 imagewidth, tsample_t spp,
|
||||
struct dump_opts * dump)
|
||||
{
|
||||
- tdata_t obuf = _TIFFmalloc(TIFFTileSize(out));
|
||||
+ /* Add 3 padding bytes for extractContigSamples32bits */
|
||||
+ tdata_t obuf = _TIFFmalloc(TIFFTileSize(out) + NUM_BUFF_OVERSIZE_BYTES);
|
||||
uint32 tl, tw;
|
||||
uint32 row, col, nrow, ncol;
|
||||
uint32 src_rowsize, col_offset;
|
||||
@@ -1333,6 +1347,7 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength
|
||||
|
||||
if (obuf == NULL)
|
||||
return 1;
|
||||
+ memset(obuf, 0, TIFFTileSize(out) + NUM_BUFF_OVERSIZE_BYTES);
|
||||
|
||||
TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
|
||||
TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
|
||||
@@ -1754,14 +1769,14 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
|
||||
|
||||
*opt_offset = '\0';
|
||||
/* convert option to lowercase */
|
||||
- end = strlen (opt_ptr);
|
||||
+ end = (unsigned int)strlen (opt_ptr);
|
||||
for (i = 0; i < end; i++)
|
||||
*(opt_ptr + i) = tolower((int) *(opt_ptr + i));
|
||||
/* Look for dump format specification */
|
||||
if (strncmp(opt_ptr, "for", 3) == 0)
|
||||
{
|
||||
/* convert value to lowercase */
|
||||
- end = strlen (opt_offset + 1);
|
||||
+ end = (unsigned int)strlen (opt_offset + 1);
|
||||
for (i = 1; i <= end; i++)
|
||||
*(opt_offset + i) = tolower((int) *(opt_offset + i));
|
||||
/* check dump format value */
|
||||
@@ -2213,6 +2228,8 @@ main(int argc, char* argv[])
|
||||
size_t length;
|
||||
char temp_filename[PATH_MAX + 16]; /* Extra space keeps the compiler from complaining */
|
||||
|
||||
+ assert(NUM_BUFF_OVERSIZE_BYTES >= 3);
|
||||
+
|
||||
little_endian = *((unsigned char *)&little_endian) & '1';
|
||||
|
||||
initImageData(&image);
|
||||
@@ -3114,13 +3131,13 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
|
||||
/* If we have a full buffer's worth, write it out */
|
||||
if (ready_bits >= 32)
|
||||
{
|
||||
- bytebuff1 = (buff2 >> 56);
|
||||
+ bytebuff1 = (uint8)(buff2 >> 56);
|
||||
*dst++ = bytebuff1;
|
||||
- bytebuff2 = (buff2 >> 48);
|
||||
+ bytebuff2 = (uint8)(buff2 >> 48);
|
||||
*dst++ = bytebuff2;
|
||||
- bytebuff3 = (buff2 >> 40);
|
||||
+ bytebuff3 = (uint8)(buff2 >> 40);
|
||||
*dst++ = bytebuff3;
|
||||
- bytebuff4 = (buff2 >> 32);
|
||||
+ bytebuff4 = (uint8)(buff2 >> 32);
|
||||
*dst++ = bytebuff4;
|
||||
ready_bits -= 32;
|
||||
|
||||
@@ -3495,13 +3512,13 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
|
||||
}
|
||||
else /* If we have a full buffer's worth, write it out */
|
||||
{
|
||||
- bytebuff1 = (buff2 >> 56);
|
||||
+ bytebuff1 = (uint8)(buff2 >> 56);
|
||||
*dst++ = bytebuff1;
|
||||
- bytebuff2 = (buff2 >> 48);
|
||||
+ bytebuff2 = (uint8)(buff2 >> 48);
|
||||
*dst++ = bytebuff2;
|
||||
- bytebuff3 = (buff2 >> 40);
|
||||
+ bytebuff3 = (uint8)(buff2 >> 40);
|
||||
*dst++ = bytebuff3;
|
||||
- bytebuff4 = (buff2 >> 32);
|
||||
+ bytebuff4 = (uint8)(buff2 >> 32);
|
||||
*dst++ = bytebuff4;
|
||||
ready_bits -= 32;
|
||||
|
||||
@@ -3678,10 +3695,10 @@ extractContigSamplesToTileBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols
|
||||
static int readContigStripsIntoBuffer (TIFF* in, uint8* buf)
|
||||
{
|
||||
uint8* bufp = buf;
|
||||
- int32 bytes_read = 0;
|
||||
+ tmsize_t bytes_read = 0;
|
||||
uint32 strip, nstrips = TIFFNumberOfStrips(in);
|
||||
- uint32 stripsize = TIFFStripSize(in);
|
||||
- uint32 rows = 0;
|
||||
+ tmsize_t stripsize = TIFFStripSize(in);
|
||||
+ tmsize_t rows = 0;
|
||||
uint32 rps = TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);
|
||||
tsize_t scanline_size = TIFFScanlineSize(in);
|
||||
|
||||
@@ -3694,13 +3711,12 @@ static int readContigStripsIntoBuffer (TIFF* in, uint8* buf)
|
||||
bytes_read = TIFFReadEncodedStrip (in, strip, bufp, -1);
|
||||
rows = bytes_read / scanline_size;
|
||||
if ((strip < (nstrips - 1)) && (bytes_read != (int32)stripsize))
|
||||
- TIFFError("", "Strip %d: read %lu bytes, strip size %lu",
|
||||
- (int)strip + 1, (unsigned long) bytes_read,
|
||||
- (unsigned long)stripsize);
|
||||
+ TIFFError("", "Strip %"PRIu32": read %"PRId64" bytes, strip size %"PRIu64,
|
||||
+ strip + 1, bytes_read, stripsize);
|
||||
|
||||
if (bytes_read < 0 && !ignore) {
|
||||
- TIFFError("", "Error reading strip %lu after %lu rows",
|
||||
- (unsigned long) strip, (unsigned long)rows);
|
||||
+ TIFFError("", "Error reading strip %"PRIu32" after %"PRIu64" rows",
|
||||
+ strip, rows);
|
||||
return 0;
|
||||
}
|
||||
bufp += stripsize;
|
||||
@@ -4164,13 +4180,13 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
|
||||
/* If we have a full buffer's worth, write it out */
|
||||
if (ready_bits >= 32)
|
||||
{
|
||||
- bytebuff1 = (buff2 >> 56);
|
||||
+ bytebuff1 = (uint8)(buff2 >> 56);
|
||||
*dst++ = bytebuff1;
|
||||
- bytebuff2 = (buff2 >> 48);
|
||||
+ bytebuff2 = (uint8)(buff2 >> 48);
|
||||
*dst++ = bytebuff2;
|
||||
- bytebuff3 = (buff2 >> 40);
|
||||
+ bytebuff3 = (uint8)(buff2 >> 40);
|
||||
*dst++ = bytebuff3;
|
||||
- bytebuff4 = (buff2 >> 32);
|
||||
+ bytebuff4 = (uint8)(buff2 >> 32);
|
||||
*dst++ = bytebuff4;
|
||||
ready_bits -= 32;
|
||||
|
||||
@@ -4213,10 +4229,10 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
|
||||
"Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d",
|
||||
row + 1, col + 1, src_byte, src_bit, dst - out);
|
||||
|
||||
- dump_long (dumpfile, format, "Match bits ", matchbits);
|
||||
+ dump_wide (dumpfile, format, "Match bits ", matchbits);
|
||||
dump_data (dumpfile, format, "Src bits ", src, 4);
|
||||
- dump_long (dumpfile, format, "Buff1 bits ", buff1);
|
||||
- dump_long (dumpfile, format, "Buff2 bits ", buff2);
|
||||
+ dump_wide (dumpfile, format, "Buff1 bits ", buff1);
|
||||
+ dump_wide (dumpfile, format, "Buff2 bits ", buff2);
|
||||
dump_byte (dumpfile, format, "Write bits1", bytebuff1);
|
||||
dump_byte (dumpfile, format, "Write bits2", bytebuff2);
|
||||
dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits);
|
||||
@@ -4689,13 +4705,13 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
|
||||
/* If we have a full buffer's worth, write it out */
|
||||
if (ready_bits >= 32)
|
||||
{
|
||||
- bytebuff1 = (buff2 >> 56);
|
||||
+ bytebuff1 = (uint8)(buff2 >> 56);
|
||||
*dst++ = bytebuff1;
|
||||
- bytebuff2 = (buff2 >> 48);
|
||||
+ bytebuff2 = (uint8)(buff2 >> 48);
|
||||
*dst++ = bytebuff2;
|
||||
- bytebuff3 = (buff2 >> 40);
|
||||
+ bytebuff3 = (uint8)(buff2 >> 40);
|
||||
*dst++ = bytebuff3;
|
||||
- bytebuff4 = (buff2 >> 32);
|
||||
+ bytebuff4 = (uint8)(buff2 >> 32);
|
||||
*dst++ = bytebuff4;
|
||||
ready_bits -= 32;
|
||||
|
||||
@@ -4738,10 +4754,10 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
|
||||
"Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d",
|
||||
row + 1, col + 1, src_byte, src_bit, dst - out);
|
||||
|
||||
- dump_long (dumpfile, format, "Match bits ", matchbits);
|
||||
+ dump_wide (dumpfile, format, "Match bits ", matchbits);
|
||||
dump_data (dumpfile, format, "Src bits ", src, 4);
|
||||
- dump_long (dumpfile, format, "Buff1 bits ", buff1);
|
||||
- dump_long (dumpfile, format, "Buff2 bits ", buff2);
|
||||
+ dump_wide (dumpfile, format, "Buff1 bits ", buff1);
|
||||
+ dump_wide (dumpfile, format, "Buff2 bits ", buff2);
|
||||
dump_byte (dumpfile, format, "Write bits1", bytebuff1);
|
||||
dump_byte (dumpfile, format, "Write bits2", bytebuff2);
|
||||
dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits);
|
||||
@@ -4764,7 +4780,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length,
|
||||
{
|
||||
int i, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;
|
||||
uint32 j;
|
||||
- int32 bytes_read = 0;
|
||||
+ tmsize_t bytes_read = 0;
|
||||
uint16 bps = 0, planar;
|
||||
uint32 nstrips;
|
||||
uint32 strips_per_sample;
|
||||
@@ -4830,7 +4846,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length,
|
||||
for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++)
|
||||
{
|
||||
srcbuffs[s] = NULL;
|
||||
- buff = _TIFFmalloc(stripsize + 3);
|
||||
+ buff = _TIFFmalloc(stripsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!buff)
|
||||
{
|
||||
TIFFError ("readSeparateStripsIntoBuffer",
|
||||
@@ -4853,7 +4869,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length,
|
||||
buff = srcbuffs[s];
|
||||
strip = (s * strips_per_sample) + j;
|
||||
bytes_read = TIFFReadEncodedStrip (in, strip, buff, stripsize);
|
||||
- rows_this_strip = bytes_read / src_rowsize;
|
||||
+ rows_this_strip = (uint32)(bytes_read / src_rowsize);
|
||||
if (bytes_read < 0 && !ignore)
|
||||
{
|
||||
TIFFError(TIFFFileName(in),
|
||||
@@ -5860,13 +5876,14 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
|
||||
uint16 input_compression = 0, input_photometric = 0;
|
||||
uint16 subsampling_horiz, subsampling_vert;
|
||||
uint32 width = 0, length = 0;
|
||||
- uint32 stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0;
|
||||
+ tmsize_t stsize = 0, tlsize = 0, buffsize = 0;
|
||||
+ tmsize_t scanlinesize = 0;
|
||||
uint32 tw = 0, tl = 0; /* Tile width and length */
|
||||
- uint32 tile_rowsize = 0;
|
||||
+ tmsize_t tile_rowsize = 0;
|
||||
unsigned char *read_buff = NULL;
|
||||
unsigned char *new_buff = NULL;
|
||||
int readunit = 0;
|
||||
- static uint32 prev_readsize = 0;
|
||||
+ static tmsize_t prev_readsize = 0;
|
||||
|
||||
TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps);
|
||||
TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp);
|
||||
@@ -6168,7 +6185,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
|
||||
TIFFError("loadImage", "Unable to allocate/reallocate read buffer");
|
||||
return (-1);
|
||||
}
|
||||
- read_buff = (unsigned char *)_TIFFmalloc(buffsize+3);
|
||||
+ read_buff = (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6179,11 +6196,11 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
|
||||
TIFFError("loadImage", "Unable to allocate/reallocate read buffer");
|
||||
return (-1);
|
||||
}
|
||||
- new_buff = _TIFFrealloc(read_buff, buffsize+3);
|
||||
+ new_buff = _TIFFrealloc(read_buff, buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!new_buff)
|
||||
{
|
||||
free (read_buff);
|
||||
- read_buff = (unsigned char *)_TIFFmalloc(buffsize+3);
|
||||
+ read_buff = (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
read_buff = new_buff;
|
||||
@@ -6256,8 +6273,13 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
|
||||
dump_info (dump->infile, dump->format, "",
|
||||
"Bits per sample %d, Samples per pixel %d", bps, spp);
|
||||
|
||||
+ if ((uint64_t)scanlinesize > 0x0ffffffffULL) {
|
||||
+ dump_info(dump->infile, dump->format, "loadImage",
|
||||
+ "Attention: scanlinesize %"PRIu64" is larger than UINT32_MAX.\nFollowing dump might be wrong.",
|
||||
+ (uint64_t)scanlinesize);
|
||||
+ }
|
||||
for (i = 0; i < length; i++)
|
||||
- dump_buffer(dump->infile, dump->format, 1, scanlinesize,
|
||||
+ dump_buffer(dump->infile, dump->format, 1, (uint32)scanlinesize,
|
||||
i, read_buff + (i * scanlinesize));
|
||||
}
|
||||
return (0);
|
||||
@@ -7277,13 +7299,13 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
|
||||
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
|
||||
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
|
||||
if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {
|
||||
- int inknameslen = strlen(inknames) + 1;
|
||||
+ int inknameslen = (int)strlen(inknames) + 1;
|
||||
const char* cp = inknames;
|
||||
while (ninks > 1) {
|
||||
cp = strchr(cp, '\0');
|
||||
if (cp) {
|
||||
cp++;
|
||||
- inknameslen += (strlen(cp) + 1);
|
||||
+ inknameslen += ((int)strlen(cp) + 1);
|
||||
}
|
||||
ninks--;
|
||||
}
|
||||
@@ -7346,23 +7368,23 @@ createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
|
||||
|
||||
if (!sect_buff)
|
||||
{
|
||||
- sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
|
||||
+ sect_buff = (unsigned char *)_TIFFmalloc(sectsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!sect_buff)
|
||||
{
|
||||
TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
|
||||
return (-1);
|
||||
}
|
||||
- _TIFFmemset(sect_buff, 0, sectsize);
|
||||
+ _TIFFmemset(sect_buff, 0, sectsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prev_sectsize < sectsize)
|
||||
{
|
||||
- new_buff = _TIFFrealloc(sect_buff, sectsize);
|
||||
+ new_buff = _TIFFrealloc(sect_buff, sectsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!new_buff)
|
||||
{
|
||||
free (sect_buff);
|
||||
- sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
|
||||
+ sect_buff = (unsigned char *)_TIFFmalloc(sectsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
sect_buff = new_buff;
|
||||
@@ -7372,7 +7394,7 @@ createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
|
||||
TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
|
||||
return (-1);
|
||||
}
|
||||
- _TIFFmemset(sect_buff, 0, sectsize);
|
||||
+ _TIFFmemset(sect_buff, 0, sectsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7403,17 +7425,17 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
cropsize = crop->bufftotal;
|
||||
crop_buff = seg_buffs[0].buffer;
|
||||
if (!crop_buff)
|
||||
- crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
+ crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
else
|
||||
{
|
||||
prev_cropsize = seg_buffs[0].size;
|
||||
if (prev_cropsize < cropsize)
|
||||
{
|
||||
- next_buff = _TIFFrealloc(crop_buff, cropsize);
|
||||
+ next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (! next_buff)
|
||||
{
|
||||
_TIFFfree (crop_buff);
|
||||
- crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
+ crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
crop_buff = next_buff;
|
||||
@@ -7426,7 +7448,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
- _TIFFmemset(crop_buff, 0, cropsize);
|
||||
+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
seg_buffs[0].buffer = crop_buff;
|
||||
seg_buffs[0].size = cropsize;
|
||||
|
||||
@@ -7505,17 +7527,17 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
cropsize = crop->bufftotal;
|
||||
crop_buff = seg_buffs[i].buffer;
|
||||
if (!crop_buff)
|
||||
- crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
+ crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
else
|
||||
{
|
||||
prev_cropsize = seg_buffs[0].size;
|
||||
if (prev_cropsize < cropsize)
|
||||
{
|
||||
- next_buff = _TIFFrealloc(crop_buff, cropsize);
|
||||
+ next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (! next_buff)
|
||||
{
|
||||
_TIFFfree (crop_buff);
|
||||
- crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
+ crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
crop_buff = next_buff;
|
||||
@@ -7528,7 +7550,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
- _TIFFmemset(crop_buff, 0, cropsize);
|
||||
+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
seg_buffs[i].buffer = crop_buff;
|
||||
seg_buffs[i].size = cropsize;
|
||||
|
||||
@@ -7641,24 +7663,24 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
|
||||
crop_buff = *crop_buff_ptr;
|
||||
if (!crop_buff)
|
||||
{
|
||||
- crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
+ crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!crop_buff)
|
||||
{
|
||||
TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
|
||||
return (-1);
|
||||
}
|
||||
- _TIFFmemset(crop_buff, 0, cropsize);
|
||||
+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
prev_cropsize = cropsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prev_cropsize < cropsize)
|
||||
{
|
||||
- new_buff = _TIFFrealloc(crop_buff, cropsize);
|
||||
+ new_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (!new_buff)
|
||||
{
|
||||
free (crop_buff);
|
||||
- crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
|
||||
+ crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
else
|
||||
crop_buff = new_buff;
|
||||
@@ -7667,7 +7689,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
|
||||
TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
|
||||
return (-1);
|
||||
}
|
||||
- _TIFFmemset(crop_buff, 0, cropsize);
|
||||
+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7965,13 +7987,13 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
|
||||
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
|
||||
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
|
||||
if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {
|
||||
- int inknameslen = strlen(inknames) + 1;
|
||||
+ int inknameslen = (int)strlen(inknames) + 1;
|
||||
const char* cp = inknames;
|
||||
while (ninks > 1) {
|
||||
cp = strchr(cp, '\0');
|
||||
if (cp) {
|
||||
cp++;
|
||||
- inknameslen += (strlen(cp) + 1);
|
||||
+ inknameslen += ((int)strlen(cp) + 1);
|
||||
}
|
||||
ninks--;
|
||||
}
|
||||
@@ -8356,13 +8378,13 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
|
||||
}
|
||||
else /* If we have a full buffer's worth, write it out */
|
||||
{
|
||||
- bytebuff1 = (buff2 >> 56);
|
||||
+ bytebuff1 = (uint8)(buff2 >> 56);
|
||||
*dst++ = bytebuff1;
|
||||
- bytebuff2 = (buff2 >> 48);
|
||||
+ bytebuff2 = (uint8)(buff2 >> 48);
|
||||
*dst++ = bytebuff2;
|
||||
- bytebuff3 = (buff2 >> 40);
|
||||
+ bytebuff3 = (uint8)(buff2 >> 40);
|
||||
*dst++ = bytebuff3;
|
||||
- bytebuff4 = (buff2 >> 32);
|
||||
+ bytebuff4 = (uint8)(buff2 >> 32);
|
||||
*dst++ = bytebuff4;
|
||||
ready_bits -= 32;
|
||||
|
||||
@@ -8431,12 +8453,13 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
- if (!(rbuff = (unsigned char *)_TIFFmalloc(buffsize)))
|
||||
+ /* Add 3 padding bytes for extractContigSamplesShifted32bits */
|
||||
+ if (!(rbuff = (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES)))
|
||||
{
|
||||
- TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize);
|
||||
+ TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
return (-1);
|
||||
}
|
||||
- _TIFFmemset(rbuff, '\0', buffsize);
|
||||
+ _TIFFmemset(rbuff, '\0', buffsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
|
||||
ibuff = *ibuff_ptr;
|
||||
switch (rotation)
|
||||
@@ -8964,13 +8987,13 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
|
||||
}
|
||||
else /* If we have a full buffer's worth, write it out */
|
||||
{
|
||||
- bytebuff1 = (buff2 >> 56);
|
||||
+ bytebuff1 = (uint8)(buff2 >> 56);
|
||||
*dst++ = bytebuff1;
|
||||
- bytebuff2 = (buff2 >> 48);
|
||||
+ bytebuff2 = (uint8)(buff2 >> 48);
|
||||
*dst++ = bytebuff2;
|
||||
- bytebuff3 = (buff2 >> 40);
|
||||
+ bytebuff3 = (uint8)(buff2 >> 40);
|
||||
*dst++ = bytebuff3;
|
||||
- bytebuff4 = (buff2 >> 32);
|
||||
+ bytebuff4 = (uint8)(buff2 >> 32);
|
||||
*dst++ = bytebuff4;
|
||||
ready_bits -= 32;
|
||||
|
||||
@@ -9061,12 +9084,13 @@ mirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length,
|
||||
{
|
||||
case MIRROR_BOTH:
|
||||
case MIRROR_VERT:
|
||||
- line_buff = (unsigned char *)_TIFFmalloc(rowsize);
|
||||
+ line_buff = (unsigned char *)_TIFFmalloc(rowsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
if (line_buff == NULL)
|
||||
{
|
||||
- TIFFError ("mirrorImage", "Unable to allocate mirror line buffer of %1u bytes", rowsize);
|
||||
+ TIFFError ("mirrorImage", "Unable to allocate mirror line buffer of %1u bytes", rowsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
return (-1);
|
||||
}
|
||||
+ _TIFFmemset(line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
|
||||
dst = ibuff + (rowsize * (length - 1));
|
||||
for (row = 0; row < length / 2; row++)
|
||||
@@ -9098,11 +9122,12 @@ mirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length,
|
||||
}
|
||||
else
|
||||
{ /* non 8 bit per sample data */
|
||||
- if (!(line_buff = (unsigned char *)_TIFFmalloc(rowsize + 1)))
|
||||
+ if (!(line_buff = (unsigned char *)_TIFFmalloc(rowsize + NUM_BUFF_OVERSIZE_BYTES)))
|
||||
{
|
||||
TIFFError("mirrorImage", "Unable to allocate mirror line buffer");
|
||||
return (-1);
|
||||
}
|
||||
+ _TIFFmemset(line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
bytes_per_sample = (bps + 7) / 8;
|
||||
bytes_per_pixel = ((bps * spp) + 7) / 8;
|
||||
if (bytes_per_pixel < (bytes_per_sample + 1))
|
||||
@@ -9114,7 +9139,7 @@ mirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length,
|
||||
{
|
||||
row_offset = row * rowsize;
|
||||
src = ibuff + row_offset;
|
||||
- _TIFFmemset (line_buff, '\0', rowsize);
|
||||
+ _TIFFmemset (line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
switch (shift_width)
|
||||
{
|
||||
case 1: if (reverseSamples16bits(spp, bps, width, src, line_buff))
|
||||
@@ -0,0 +1,123 @@
|
||||
From f7c06c395daf1b2c52ab431e00db2d9fc2ac993e Mon Sep 17 00:00:00 2001
|
||||
From: Su Laus <sulau@freenet.de>
|
||||
Date: Tue, 10 May 2022 20:03:17 +0000
|
||||
Subject: [PATCH] tiffcrop: Fix issue #330 and some more from 320 to 349
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
|
||||
CVE: CVE-2022-3597 CVE-2022-3626 CVE-2022-3627
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/e319508023580e2f70e6e626f745b5b2a1707313
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/8fe3735942ea1d90d8cef843b55b3efe8ab6feaf
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/bad48e90b410df32172006c7876da449ba62cdba
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/236b7191f04c60d09ee836ae13b50f812c841047
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Last-Update: 2023-01-17
|
||||
|
||||
---
|
||||
tools/tiffcrop.c | 50 ++++++++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 42 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index c923920..a0789a3 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -103,7 +103,12 @@
|
||||
* selects which functions dump data, with higher numbers selecting
|
||||
* lower level, scanline level routines. Debug reports a limited set
|
||||
* of messages to monitor progess without enabling dump logs.
|
||||
- */
|
||||
+ *
|
||||
+ * Note 1: The (-X|-Y), -Z, -z and -S options are mutually exclusive.
|
||||
+ * In no case should the options be applied to a given selection successively.
|
||||
+ * Note 2: Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options
|
||||
+ * such as -H, -V, -P, -J or -K are not supported and may cause buffer overflows.
|
||||
+ */
|
||||
|
||||
static char tiffcrop_version_id[] = "2.4.1";
|
||||
static char tiffcrop_rev_date[] = "03-03-2010";
|
||||
@@ -176,12 +181,12 @@ extern int getopt(int argc, char * const argv[], const char *optstring);
|
||||
#define ROTATECW_270 32
|
||||
#define ROTATE_ANY (ROTATECW_90 | ROTATECW_180 | ROTATECW_270)
|
||||
|
||||
-#define CROP_NONE 0
|
||||
-#define CROP_MARGINS 1
|
||||
-#define CROP_WIDTH 2
|
||||
-#define CROP_LENGTH 4
|
||||
-#define CROP_ZONES 8
|
||||
-#define CROP_REGIONS 16
|
||||
+#define CROP_NONE 0 /* "-S" -> Page_MODE_ROWSCOLS and page->rows/->cols != 0 */
|
||||
+#define CROP_MARGINS 1 /* "-m" */
|
||||
+#define CROP_WIDTH 2 /* "-X" */
|
||||
+#define CROP_LENGTH 4 /* "-Y" */
|
||||
+#define CROP_ZONES 8 /* "-Z" */
|
||||
+#define CROP_REGIONS 16 /* "-z" */
|
||||
#define CROP_ROTATE 32
|
||||
#define CROP_MIRROR 64
|
||||
#define CROP_INVERT 128
|
||||
@@ -323,7 +328,7 @@ struct crop_mask {
|
||||
#define PAGE_MODE_RESOLUTION 1
|
||||
#define PAGE_MODE_PAPERSIZE 2
|
||||
#define PAGE_MODE_MARGINS 4
|
||||
-#define PAGE_MODE_ROWSCOLS 8
|
||||
+#define PAGE_MODE_ROWSCOLS 8 /* for -S option */
|
||||
|
||||
#define INVERT_DATA_ONLY 10
|
||||
#define INVERT_DATA_AND_TAG 11
|
||||
@@ -754,6 +759,12 @@ static char* usage_info[] = {
|
||||
" The four debug/dump options are independent, though it makes little sense to",
|
||||
" specify a dump file without specifying a detail level.",
|
||||
" ",
|
||||
+"Note 1: The (-X|-Y), -Z, -z and -S options are mutually exclusive.",
|
||||
+" In no case should the options be applied to a given selection successively.",
|
||||
+" ",
|
||||
+"Note 2: Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options",
|
||||
+" such as - H, -V, -P, -J or -K are not supported and may cause buffer overflows.",
|
||||
+" ",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -2112,6 +2123,27 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
+ /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/
|
||||
+ char XY, Z, R, S;
|
||||
+ XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)) ? 1 : 0;
|
||||
+ Z = (crop_data->crop_mode & CROP_ZONES) ? 1 : 0;
|
||||
+ R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0;
|
||||
+ S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0;
|
||||
+ if (XY + Z + R + S > 1) {
|
||||
+ TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->exit");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ /* Check for not allowed combination:
|
||||
+ * Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options
|
||||
+ * such as -H, -V, -P, -J or -K are not supported and may cause buffer overflows.
|
||||
+. */
|
||||
+ if ((XY + Z + R > 0) && page->mode != PAGE_MODE_NONE) {
|
||||
+ TIFFError("tiffcrop input error",
|
||||
+ "Any of the crop options -X, -Y, -Z and -z together with other PAGE_MODE_x options such as - H, -V, -P, -J or -K is not supported and may cause buffer overflows..->exit");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
} /* end process_command_opts */
|
||||
|
||||
/* Start a new output file if one has not been previously opened or
|
||||
@@ -2384,6 +2416,7 @@ main(int argc, char* argv[])
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
+ /* Crop input image and copy zones and regions from input image into seg_buffs or crop_buff. */
|
||||
if (crop.selections > 0)
|
||||
{
|
||||
if (processCropSelections(&image, &crop, &read_buff, seg_buffs))
|
||||
@@ -2400,6 +2433,7 @@ main(int argc, char* argv[])
|
||||
exit (-1);
|
||||
}
|
||||
}
|
||||
+ /* Format and write selected image parts to output file(s). */
|
||||
if (page.mode == PAGE_MODE_NONE)
|
||||
{ /* Whole image or sections not based on output page size */
|
||||
if (crop.selections > 0)
|
||||
277
meta/recipes-multimedia/libtiff/files/CVE-2022-3599.patch
Normal file
277
meta/recipes-multimedia/libtiff/files/CVE-2022-3599.patch
Normal file
@@ -0,0 +1,277 @@
|
||||
From 01bca7e6f608da7696949fca6acda78b9935ba19 Mon Sep 17 00:00:00 2001
|
||||
From: Su_Laus <sulau@freenet.de>
|
||||
Date: Tue, 30 Aug 2022 16:56:48 +0200
|
||||
Subject: [PATCH] Revised handling of TIFFTAG_INKNAMES and related
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
|
||||
CVE: CVE-2022-3599
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/e813112545942107551433d61afd16ac094ff246
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Last-Update: 2023-01-17
|
||||
|
||||
TIFFTAG_NUMBEROFINKS value
|
||||
|
||||
In order to solve the buffer overflow issues related to TIFFTAG_INKNAMES and related TIFFTAG_NUMBEROFINKS value, a revised handling of those tags within LibTiff is proposed:
|
||||
|
||||
Behaviour for writing:
|
||||
`NumberOfInks` MUST fit to the number of inks in the `InkNames` string.
|
||||
`NumberOfInks` is automatically set when `InkNames` is set.
|
||||
If `NumberOfInks` is different to the number of inks within `InkNames` string, that will be corrected and a warning is issued.
|
||||
If `NumberOfInks` is not equal to samplesperpixel only a warning will be issued.
|
||||
|
||||
Behaviour for reading:
|
||||
When reading `InkNames` from a TIFF file, the `NumberOfInks` will be set automatically to the number of inks in `InkNames` string.
|
||||
If `NumberOfInks` is different to the number of inks within `InkNames` string, that will be corrected and a warning is issued.
|
||||
If `NumberOfInks` is not equal to samplesperpixel only a warning will be issued.
|
||||
|
||||
This allows the safe use of the NumberOfInks value to read out the InkNames without buffer overflow
|
||||
|
||||
This MR will close the following issues: #149, #150, #152, #168 (to be checked), #250, #269, #398 and #456.
|
||||
|
||||
It also fixes the old bug at http://bugzilla.maptools.org/show_bug.cgi?id=2599, for which the limitation of `NumberOfInks = SPP` was introduced, which is in my opinion not necessary and does not solve the general issue.
|
||||
|
||||
---
|
||||
libtiff/tif_dir.c | 120 ++++++++++++++++++++++++-----------------
|
||||
libtiff/tif_dir.h | 2 +
|
||||
libtiff/tif_dirinfo.c | 2 +-
|
||||
libtiff/tif_dirwrite.c | 5 ++
|
||||
libtiff/tif_print.c | 4 ++
|
||||
5 files changed, 83 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
|
||||
index 39aeeb4..9d8267a 100644
|
||||
--- a/libtiff/tif_dir.c
|
||||
+++ b/libtiff/tif_dir.c
|
||||
@@ -29,6 +29,7 @@
|
||||
* (and also some miscellaneous stuff)
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
+# include <inttypes.h>
|
||||
|
||||
/*
|
||||
* These are used in the backwards compatibility code...
|
||||
@@ -137,32 +138,30 @@ setExtraSamples(TIFF* tif, va_list ap, uint32* v)
|
||||
}
|
||||
|
||||
/*
|
||||
- * Confirm we have "samplesperpixel" ink names separated by \0. Returns
|
||||
+ * Count ink names separated by \0. Returns
|
||||
* zero if the ink names are not as expected.
|
||||
*/
|
||||
-static uint32
|
||||
-checkInkNamesString(TIFF* tif, uint32 slen, const char* s)
|
||||
+static uint16
|
||||
+countInkNamesString(TIFF *tif, uint32 slen, const char *s)
|
||||
{
|
||||
- TIFFDirectory* td = &tif->tif_dir;
|
||||
- uint16 i = td->td_samplesperpixel;
|
||||
+ uint16 i = 0;
|
||||
+ const char *ep = s + slen;
|
||||
+ const char *cp = s;
|
||||
|
||||
if (slen > 0) {
|
||||
- const char* ep = s+slen;
|
||||
- const char* cp = s;
|
||||
- for (; i > 0; i--) {
|
||||
+ do {
|
||||
for (; cp < ep && *cp != '\0'; cp++) {}
|
||||
if (cp >= ep)
|
||||
goto bad;
|
||||
cp++; /* skip \0 */
|
||||
- }
|
||||
- return ((uint32)(cp-s));
|
||||
+ i++;
|
||||
+ } while (cp < ep);
|
||||
+ return (i);
|
||||
}
|
||||
bad:
|
||||
TIFFErrorExt(tif->tif_clientdata, "TIFFSetField",
|
||||
- "%s: Invalid InkNames value; expecting %d names, found %d",
|
||||
- tif->tif_name,
|
||||
- td->td_samplesperpixel,
|
||||
- td->td_samplesperpixel-i);
|
||||
+ "%s: Invalid InkNames value; no NUL at given buffer end location %"PRIu32", after %"PRIu16" ink",
|
||||
+ tif->tif_name, slen, i);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -476,13 +475,61 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
||||
_TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
|
||||
break;
|
||||
case TIFFTAG_INKNAMES:
|
||||
- v = (uint16) va_arg(ap, uint16_vap);
|
||||
- s = va_arg(ap, char*);
|
||||
- v = checkInkNamesString(tif, v, s);
|
||||
- status = v > 0;
|
||||
- if( v > 0 ) {
|
||||
- _TIFFsetNString(&td->td_inknames, s, v);
|
||||
- td->td_inknameslen = v;
|
||||
+ {
|
||||
+ v = (uint16) va_arg(ap, uint16_vap);
|
||||
+ s = va_arg(ap, char*);
|
||||
+ uint16 ninksinstring;
|
||||
+ ninksinstring = countInkNamesString(tif, v, s);
|
||||
+ status = ninksinstring > 0;
|
||||
+ if(ninksinstring > 0 ) {
|
||||
+ _TIFFsetNString(&td->td_inknames, s, v);
|
||||
+ td->td_inknameslen = v;
|
||||
+ /* Set NumberOfInks to the value ninksinstring */
|
||||
+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS))
|
||||
+ {
|
||||
+ if (td->td_numberofinks != ninksinstring) {
|
||||
+ TIFFErrorExt(tif->tif_clientdata, module,
|
||||
+ "Warning %s; Tag %s:\n Value %"PRIu16" of NumberOfInks is different from the number of inks %"PRIu16".\n -> NumberOfInks value adapted to %"PRIu16"",
|
||||
+ tif->tif_name, fip->field_name, td->td_numberofinks, ninksinstring, ninksinstring);
|
||||
+ td->td_numberofinks = ninksinstring;
|
||||
+ }
|
||||
+ } else {
|
||||
+ td->td_numberofinks = ninksinstring;
|
||||
+ TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS);
|
||||
+ }
|
||||
+ if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
|
||||
+ {
|
||||
+ if (td->td_numberofinks != td->td_samplesperpixel) {
|
||||
+ TIFFErrorExt(tif->tif_clientdata, module,
|
||||
+ "Warning %s; Tag %s:\n Value %"PRIu16" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"",
|
||||
+ tif->tif_name, fip->field_name, td->td_numberofinks, td->td_samplesperpixel);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ case TIFFTAG_NUMBEROFINKS:
|
||||
+ v = (uint16)va_arg(ap, uint16_vap);
|
||||
+ /* If InkNames already set also NumberOfInks is set accordingly and should be equal */
|
||||
+ if (TIFFFieldSet(tif, FIELD_INKNAMES))
|
||||
+ {
|
||||
+ if (v != td->td_numberofinks) {
|
||||
+ TIFFErrorExt(tif->tif_clientdata, module,
|
||||
+ "Error %s; Tag %s:\n It is not possible to set the value %"PRIu32" for NumberOfInks\n which is different from the number of inks in the InkNames tag (%"PRIu16")",
|
||||
+ tif->tif_name, fip->field_name, v, td->td_numberofinks);
|
||||
+ /* Do not set / overwrite number of inks already set by InkNames case accordingly. */
|
||||
+ status = 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ td->td_numberofinks = (uint16)v;
|
||||
+ if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
|
||||
+ {
|
||||
+ if (td->td_numberofinks != td->td_samplesperpixel) {
|
||||
+ TIFFErrorExt(tif->tif_clientdata, module,
|
||||
+ "Warning %s; Tag %s:\n Value %"PRIu32" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"",
|
||||
+ tif->tif_name, fip->field_name, v, td->td_samplesperpixel);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case TIFFTAG_PERSAMPLE:
|
||||
@@ -887,34 +934,6 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
|
||||
if (fip->field_bit == FIELD_CUSTOM) {
|
||||
standard_tag = 0;
|
||||
}
|
||||
-
|
||||
- if( standard_tag == TIFFTAG_NUMBEROFINKS )
|
||||
- {
|
||||
- int i;
|
||||
- for (i = 0; i < td->td_customValueCount; i++) {
|
||||
- uint16 val;
|
||||
- TIFFTagValue *tv = td->td_customValues + i;
|
||||
- if (tv->info->field_tag != standard_tag)
|
||||
- continue;
|
||||
- if( tv->value == NULL )
|
||||
- return 0;
|
||||
- val = *(uint16 *)tv->value;
|
||||
- /* Truncate to SamplesPerPixel, since the */
|
||||
- /* setting code for INKNAMES assume that there are SamplesPerPixel */
|
||||
- /* inknames. */
|
||||
- /* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 */
|
||||
- if( val > td->td_samplesperpixel )
|
||||
- {
|
||||
- TIFFWarningExt(tif->tif_clientdata,"_TIFFVGetField",
|
||||
- "Truncating NumberOfInks from %u to %u",
|
||||
- val, td->td_samplesperpixel);
|
||||
- val = td->td_samplesperpixel;
|
||||
- }
|
||||
- *va_arg(ap, uint16*) = val;
|
||||
- return 1;
|
||||
- }
|
||||
- return 0;
|
||||
- }
|
||||
|
||||
switch (standard_tag) {
|
||||
case TIFFTAG_SUBFILETYPE:
|
||||
@@ -1092,6 +1111,9 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
|
||||
case TIFFTAG_INKNAMES:
|
||||
*va_arg(ap, char**) = td->td_inknames;
|
||||
break;
|
||||
+ case TIFFTAG_NUMBEROFINKS:
|
||||
+ *va_arg(ap, uint16 *) = td->td_numberofinks;
|
||||
+ break;
|
||||
default:
|
||||
{
|
||||
int i;
|
||||
diff --git a/libtiff/tif_dir.h b/libtiff/tif_dir.h
|
||||
index e7f0667..7cad679 100644
|
||||
--- a/libtiff/tif_dir.h
|
||||
+++ b/libtiff/tif_dir.h
|
||||
@@ -117,6 +117,7 @@ typedef struct {
|
||||
/* CMYK parameters */
|
||||
int td_inknameslen;
|
||||
char* td_inknames;
|
||||
+ uint16 td_numberofinks; /* number of inks in InkNames string */
|
||||
|
||||
int td_customValueCount;
|
||||
TIFFTagValue *td_customValues;
|
||||
@@ -174,6 +175,7 @@ typedef struct {
|
||||
#define FIELD_TRANSFERFUNCTION 44
|
||||
#define FIELD_INKNAMES 46
|
||||
#define FIELD_SUBIFD 49
|
||||
+#define FIELD_NUMBEROFINKS 50
|
||||
/* FIELD_CUSTOM (see tiffio.h) 65 */
|
||||
/* end of support for well-known tags; codec-private tags follow */
|
||||
#define FIELD_CODEC 66 /* base of codec-private tags */
|
||||
diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
|
||||
index fbfaaf0..bf7de70 100644
|
||||
--- a/libtiff/tif_dirinfo.c
|
||||
+++ b/libtiff/tif_dirinfo.c
|
||||
@@ -104,7 +104,7 @@ tiffFields[] = {
|
||||
{ TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray*) &tiffFieldArray },
|
||||
{ TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL },
|
||||
{ TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL },
|
||||
- { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NumberOfInks", NULL },
|
||||
+ { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_NUMBEROFINKS, 1, 0, "NumberOfInks", NULL },
|
||||
{ TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DotRange", NULL },
|
||||
{ TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL },
|
||||
{ TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL },
|
||||
diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
|
||||
index 9e4d306..a2dbc3b 100644
|
||||
--- a/libtiff/tif_dirwrite.c
|
||||
+++ b/libtiff/tif_dirwrite.c
|
||||
@@ -677,6 +677,11 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
|
||||
if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,TIFFTAG_INKNAMES,tif->tif_dir.td_inknameslen,tif->tif_dir.td_inknames))
|
||||
goto bad;
|
||||
}
|
||||
+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS))
|
||||
+ {
|
||||
+ if (!TIFFWriteDirectoryTagShort(tif, &ndir, dir, TIFFTAG_NUMBEROFINKS, tif->tif_dir.td_numberofinks))
|
||||
+ goto bad;
|
||||
+ }
|
||||
if (TIFFFieldSet(tif,FIELD_SUBIFD))
|
||||
{
|
||||
if (!TIFFWriteDirectoryTagSubifd(tif,&ndir,dir))
|
||||
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
|
||||
index a073794..a9f05a7 100644
|
||||
--- a/libtiff/tif_print.c
|
||||
+++ b/libtiff/tif_print.c
|
||||
@@ -402,6 +402,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
||||
}
|
||||
fputs("\n", fd);
|
||||
}
|
||||
+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) {
|
||||
+ fprintf(fd, " NumberOfInks: %d\n",
|
||||
+ td->td_numberofinks);
|
||||
+ }
|
||||
if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {
|
||||
fprintf(fd, " Thresholding: ");
|
||||
switch (td->td_threshholding) {
|
||||
45
meta/recipes-multimedia/libtiff/files/CVE-2022-3970.patch
Normal file
45
meta/recipes-multimedia/libtiff/files/CVE-2022-3970.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 7e87352217d1f0c77eee7033ac59e3aab08532bb Mon Sep 17 00:00:00 2001
|
||||
From: Even Rouault <even.rouault@spatialys.com>
|
||||
Date: Tue, 8 Nov 2022 15:16:58 +0100
|
||||
Subject: [PATCH] TIFFReadRGBATileExt(): fix (unsigned) integer overflow on
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
|
||||
CVE: CVE-2022-3970
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/227500897dfb07fb7d27f7aa570050e62617e3be
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Last-Update: 2023-01-17
|
||||
|
||||
strips/tiles > 2 GB
|
||||
|
||||
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53137
|
||||
|
||||
---
|
||||
libtiff/tif_getimage.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
|
||||
index 96ab146..0b90dcc 100644
|
||||
--- a/libtiff/tif_getimage.c
|
||||
+++ b/libtiff/tif_getimage.c
|
||||
@@ -3042,15 +3042,15 @@ TIFFReadRGBATileExt(TIFF* tif, uint32 col, uint32 row, uint32 * raster, int stop
|
||||
return( ok );
|
||||
|
||||
for( i_row = 0; i_row < read_ysize; i_row++ ) {
|
||||
- memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||||
- raster + (read_ysize - i_row - 1) * read_xsize,
|
||||
+ memmove( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize,
|
||||
+ raster + (size_t)(read_ysize - i_row - 1) * read_xsize,
|
||||
read_xsize * sizeof(uint32) );
|
||||
- _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,
|
||||
+ _TIFFmemset( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize+read_xsize,
|
||||
0, sizeof(uint32) * (tile_xsize - read_xsize) );
|
||||
}
|
||||
|
||||
for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
|
||||
- _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||||
+ _TIFFmemset( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize,
|
||||
0, sizeof(uint32) * tile_xsize );
|
||||
}
|
||||
|
||||
26
meta/recipes-multimedia/libtiff/files/CVE-2022-48281.patch
Normal file
26
meta/recipes-multimedia/libtiff/files/CVE-2022-48281.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 424c82b5b33256e7f03faace51dc8010f3ded9ff Mon Sep 17 00:00:00 2001
|
||||
From: Su Laus <sulau@freenet.de>
|
||||
Date: Sat, 21 Jan 2023 15:58:10 +0000
|
||||
Subject: [PATCH] tiffcrop: Correct simple copy paste error. Fix #488.
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz]
|
||||
CVE: CVE-2022-48281
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
|
||||
---
|
||||
tools/tiffcrop.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index a0789a3..8aed9cd 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -7564,7 +7564,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
crop_buff = (unsigned char *)_TIFFmalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
else
|
||||
{
|
||||
- prev_cropsize = seg_buffs[0].size;
|
||||
+ prev_cropsize = seg_buffs[i].size;
|
||||
if (prev_cropsize < cropsize)
|
||||
{
|
||||
next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES);
|
||||
@@ -0,0 +1,157 @@
|
||||
From 7808740e100ba30ffb791044f3b14dec3e85ed6f Mon Sep 17 00:00:00 2001
|
||||
From: Markus Koschany <apo@debian.org>
|
||||
Date: Tue, 21 Feb 2023 14:26:43 +0100
|
||||
Subject: [PATCH] CVE-2023-0795
|
||||
|
||||
This is also the fix for CVE-2023-0796, CVE-2023-0797, CVE-2023-0798,
|
||||
CVE-2023-0799.
|
||||
|
||||
Bug-Debian: https://bugs.debian.org/1031632
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/afaabc3e50d4e5d80a94143f7e3c997e7e410f68
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
|
||||
CVE: CVE-2023-0795 CVE-2023-0796 CVE-2023-0797 CVE-2023-0798 CVE-2023-0799
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
tools/tiffcrop.c | 51 ++++++++++++++++++++++++++++--------------------
|
||||
1 file changed, 30 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index 8aed9cd..f21a7d7 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -277,7 +277,6 @@ struct region {
|
||||
uint32 width; /* width in pixels */
|
||||
uint32 length; /* length in pixels */
|
||||
uint32 buffsize; /* size of buffer needed to hold the cropped region */
|
||||
- unsigned char *buffptr; /* address of start of the region */
|
||||
};
|
||||
|
||||
/* Cropping parameters from command line and image data
|
||||
@@ -532,7 +531,7 @@ static int rotateContigSamples24bits(uint16, uint16, uint16, uint32,
|
||||
static int rotateContigSamples32bits(uint16, uint16, uint16, uint32,
|
||||
uint32, uint32, uint8 *, uint8 *);
|
||||
static int rotateImage(uint16, struct image_data *, uint32 *, uint32 *,
|
||||
- unsigned char **);
|
||||
+ unsigned char **, int);
|
||||
static int mirrorImage(uint16, uint16, uint16, uint32, uint32,
|
||||
unsigned char *);
|
||||
static int invertImage(uint16, uint16, uint16, uint32, uint32,
|
||||
@@ -5112,7 +5111,6 @@ initCropMasks (struct crop_mask *cps)
|
||||
cps->regionlist[i].width = 0;
|
||||
cps->regionlist[i].length = 0;
|
||||
cps->regionlist[i].buffsize = 0;
|
||||
- cps->regionlist[i].buffptr = NULL;
|
||||
cps->zonelist[i].position = 0;
|
||||
cps->zonelist[i].total = 0;
|
||||
}
|
||||
@@ -6358,8 +6356,13 @@ static int correct_orientation(struct image_data *image, unsigned char **work_b
|
||||
image->adjustments & ROTATE_ANY);
|
||||
return (-1);
|
||||
}
|
||||
-
|
||||
- if (rotateImage(rotation, image, &image->width, &image->length, work_buff_ptr))
|
||||
+
|
||||
+ /* Dummy variable in order not to switch two times the
|
||||
+ * image->width,->length within rotateImage(),
|
||||
+ * but switch xres, yres there. */
|
||||
+ uint32_t width = image->width;
|
||||
+ uint32_t length = image->length;
|
||||
+ if (rotateImage(rotation, image, &width, &length, work_buff_ptr, TRUE))
|
||||
{
|
||||
TIFFError ("correct_orientation", "Unable to rotate image");
|
||||
return (-1);
|
||||
@@ -6427,7 +6430,6 @@ extractCompositeRegions(struct image_data *image, struct crop_mask *crop,
|
||||
/* These should not be needed for composite images */
|
||||
crop->regionlist[i].width = crop_width;
|
||||
crop->regionlist[i].length = crop_length;
|
||||
- crop->regionlist[i].buffptr = crop_buff;
|
||||
|
||||
src_rowsize = ((img_width * bps * spp) + 7) / 8;
|
||||
dst_rowsize = (((crop_width * bps * count) + 7) / 8);
|
||||
@@ -6664,7 +6666,6 @@ extractSeparateRegion(struct image_data *image, struct crop_mask *crop,
|
||||
|
||||
crop->regionlist[region].width = crop_width;
|
||||
crop->regionlist[region].length = crop_length;
|
||||
- crop->regionlist[region].buffptr = crop_buff;
|
||||
|
||||
src = read_buff;
|
||||
dst = crop_buff;
|
||||
@@ -7542,7 +7543,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
|
||||
{
|
||||
if (rotateImage(crop->rotation, image, &crop->combined_width,
|
||||
- &crop->combined_length, &crop_buff))
|
||||
+ &crop->combined_length, &crop_buff, FALSE))
|
||||
{
|
||||
TIFFError("processCropSelections",
|
||||
"Failed to rotate composite regions by %d degrees", crop->rotation);
|
||||
@@ -7648,7 +7649,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
|
||||
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
|
||||
{
|
||||
if (rotateImage(crop->rotation, image, &crop->regionlist[i].width,
|
||||
- &crop->regionlist[i].length, &crop_buff))
|
||||
+ &crop->regionlist[i].length, &crop_buff, FALSE))
|
||||
{
|
||||
TIFFError("processCropSelections",
|
||||
"Failed to rotate crop region by %d degrees", crop->rotation);
|
||||
@@ -7780,7 +7781,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
|
||||
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
|
||||
{
|
||||
if (rotateImage(crop->rotation, image, &crop->combined_width,
|
||||
- &crop->combined_length, crop_buff_ptr))
|
||||
+ &crop->combined_length, crop_buff_ptr, TRUE))
|
||||
{
|
||||
TIFFError("createCroppedImage",
|
||||
"Failed to rotate image or cropped selection by %d degrees", crop->rotation);
|
||||
@@ -8443,7 +8444,7 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
|
||||
/* Rotate an image by a multiple of 90 degrees clockwise */
|
||||
static int
|
||||
rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
|
||||
- uint32 *img_length, unsigned char **ibuff_ptr)
|
||||
+ uint32 *img_length, unsigned char **ibuff_ptr, int rot_image_params)
|
||||
{
|
||||
int shift_width;
|
||||
uint32 bytes_per_pixel, bytes_per_sample;
|
||||
@@ -8634,11 +8635,15 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
|
||||
|
||||
*img_width = length;
|
||||
*img_length = width;
|
||||
- image->width = length;
|
||||
- image->length = width;
|
||||
- res_temp = image->xres;
|
||||
- image->xres = image->yres;
|
||||
- image->yres = res_temp;
|
||||
+ /* Only toggle image parameters if whole input image is rotated. */
|
||||
+ if (rot_image_params)
|
||||
+ {
|
||||
+ image->width = length;
|
||||
+ image->length = width;
|
||||
+ res_temp = image->xres;
|
||||
+ image->xres = image->yres;
|
||||
+ image->yres = res_temp;
|
||||
+ }
|
||||
break;
|
||||
|
||||
case 270: if ((bps % 8) == 0) /* byte aligned data */
|
||||
@@ -8711,11 +8716,15 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
|
||||
|
||||
*img_width = length;
|
||||
*img_length = width;
|
||||
- image->width = length;
|
||||
- image->length = width;
|
||||
- res_temp = image->xres;
|
||||
- image->xres = image->yres;
|
||||
- image->yres = res_temp;
|
||||
+ /* Only toggle image parameters if whole input image is rotated. */
|
||||
+ if (rot_image_params)
|
||||
+ {
|
||||
+ image->width = length;
|
||||
+ image->length = width;
|
||||
+ res_temp = image->xres;
|
||||
+ image->xres = image->yres;
|
||||
+ image->yres = res_temp;
|
||||
+ }
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -0,0 +1,135 @@
|
||||
From e18be834497e0ebf68d443abb9e18187f36cd3bf Mon Sep 17 00:00:00 2001
|
||||
From: Markus Koschany <apo@debian.org>
|
||||
Date: Tue, 21 Feb 2023 14:39:52 +0100
|
||||
Subject: [PATCH] CVE-2023-0800
|
||||
|
||||
This is also the fix for CVE-2023-0801, CVE-2023-0802, CVE-2023-0803,
|
||||
CVE-2023-0804.
|
||||
|
||||
Bug-Debian: https://bugs.debian.org/1031632
|
||||
Origin: https://gitlab.com/libtiff/libtiff/-/commit/33aee1275d9d1384791d2206776eb8152d397f00
|
||||
|
||||
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
|
||||
CVE: CVE-2023-0800 CVE-2023-0801 CVE-2023-0802 CVE-2023-0803 CVE-2023-0804
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
tools/tiffcrop.c | 73 +++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 69 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
|
||||
index f21a7d7..742615a 100644
|
||||
--- a/tools/tiffcrop.c
|
||||
+++ b/tools/tiffcrop.c
|
||||
@@ -5250,18 +5250,40 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,
|
||||
|
||||
crop->regionlist[i].buffsize = buffsize;
|
||||
crop->bufftotal += buffsize;
|
||||
+
|
||||
+ /* For composite images with more than one region, the
|
||||
+ * combined_length or combined_width always needs to be equal,
|
||||
+ * respectively.
|
||||
+ * Otherwise, even the first section/region copy
|
||||
+ * action might cause buffer overrun. */
|
||||
if (crop->img_mode == COMPOSITE_IMAGES)
|
||||
{
|
||||
switch (crop->edge_ref)
|
||||
{
|
||||
case EDGE_LEFT:
|
||||
case EDGE_RIGHT:
|
||||
+ if (i > 0 && zlength != crop->combined_length)
|
||||
+ {
|
||||
+ TIFFError(
|
||||
+ "computeInputPixelOffsets",
|
||||
+ "Only equal length regions can be combined for "
|
||||
+ "-E left or right");
|
||||
+ return (-1);
|
||||
+ }
|
||||
crop->combined_length = zlength;
|
||||
crop->combined_width += zwidth;
|
||||
break;
|
||||
case EDGE_BOTTOM:
|
||||
case EDGE_TOP: /* width from left, length from top */
|
||||
default:
|
||||
+ if (i > 0 && zwidth != crop->combined_width)
|
||||
+ {
|
||||
+ TIFFError("computeInputPixelOffsets",
|
||||
+ "Only equal width regions can be "
|
||||
+ "combined for -E "
|
||||
+ "top or bottom");
|
||||
+ return (-1);
|
||||
+ }
|
||||
crop->combined_width = zwidth;
|
||||
crop->combined_length += zlength;
|
||||
break;
|
||||
@@ -6416,6 +6438,47 @@ extractCompositeRegions(struct image_data *image, struct crop_mask *crop,
|
||||
crop->combined_width = 0;
|
||||
crop->combined_length = 0;
|
||||
|
||||
+ /* If there is more than one region, check beforehand whether all the width
|
||||
+ * and length values of the regions are the same, respectively. */
|
||||
+ switch (crop->edge_ref)
|
||||
+ {
|
||||
+ default:
|
||||
+ case EDGE_TOP:
|
||||
+ case EDGE_BOTTOM:
|
||||
+ for (i = 1; i < crop->selections; i++)
|
||||
+ {
|
||||
+ uint32_t crop_width0 =
|
||||
+ crop->regionlist[i - 1].x2 - crop->regionlist[i - 1].x1 + 1;
|
||||
+ uint32_t crop_width1 =
|
||||
+ crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1;
|
||||
+ if (crop_width0 != crop_width1)
|
||||
+ {
|
||||
+ TIFFError("extractCompositeRegions",
|
||||
+ "Only equal width regions can be combined for -E "
|
||||
+ "top or bottom");
|
||||
+ return (1);
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ case EDGE_LEFT:
|
||||
+ case EDGE_RIGHT:
|
||||
+ for (i = 1; i < crop->selections; i++)
|
||||
+ {
|
||||
+ uint32_t crop_length0 =
|
||||
+ crop->regionlist[i - 1].y2 - crop->regionlist[i - 1].y1 + 1;
|
||||
+ uint32_t crop_length1 =
|
||||
+ crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;
|
||||
+ if (crop_length0 != crop_length1)
|
||||
+ {
|
||||
+ TIFFError("extractCompositeRegions",
|
||||
+ "Only equal length regions can be combined for "
|
||||
+ "-E left or right");
|
||||
+ return (1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
for (i = 0; i < crop->selections; i++)
|
||||
{
|
||||
/* rows, columns, width, length are expressed in pixels */
|
||||
@@ -6439,8 +6502,9 @@ extractCompositeRegions(struct image_data *image, struct crop_mask *crop,
|
||||
default:
|
||||
case EDGE_TOP:
|
||||
case EDGE_BOTTOM:
|
||||
- if ((i > 0) && (crop_width != crop->regionlist[i - 1].width))
|
||||
- {
|
||||
+ if ((crop->selections > i + 1) &&
|
||||
+ (crop_width != crop->regionlist[i + 1].width))
|
||||
+ {
|
||||
TIFFError ("extractCompositeRegions",
|
||||
"Only equal width regions can be combined for -E top or bottom");
|
||||
return (1);
|
||||
@@ -6520,8 +6584,9 @@ extractCompositeRegions(struct image_data *image, struct crop_mask *crop,
|
||||
break;
|
||||
case EDGE_LEFT: /* splice the pieces of each row together, side by side */
|
||||
case EDGE_RIGHT:
|
||||
- if ((i > 0) && (crop_length != crop->regionlist[i - 1].length))
|
||||
- {
|
||||
+ if ((crop->selections > i + 1) &&
|
||||
+ (crop_length != crop->regionlist[i + 1].length))
|
||||
+ {
|
||||
TIFFError ("extractCompositeRegions",
|
||||
"Only equal length regions can be combined for -E left or right");
|
||||
return (1);
|
||||
@@ -29,6 +29,13 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
|
||||
file://CVE-2022-2867-CVE-2022-2868-CVE-2022-2869.patch \
|
||||
file://CVE-2022-1354.patch \
|
||||
file://CVE-2022-1355.patch \
|
||||
file://CVE-2022-3570_3598.patch \
|
||||
file://CVE-2022-3597_3626_3627.patch \
|
||||
file://CVE-2022-3599.patch \
|
||||
file://CVE-2022-3970.patch \
|
||||
file://CVE-2022-48281.patch \
|
||||
file://CVE-2023-0795_0796_0797_0798_0799.patch \
|
||||
file://CVE-2023-0800_0801_0802_0803_0804.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "2165e7aba557463acc0664e71a3ed424"
|
||||
SRC_URI[sha256sum] = "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634"
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
From 6b638fa9afbeb54dfa19378e391465a5284ce1ad Mon Sep 17 00:00:00 2001
|
||||
From: Changqing Li <changqing.li@windriver.com>
|
||||
Date: Wed, 12 Sep 2018 17:16:36 +0800
|
||||
Subject: [PATCH] Fix error handling in gdbm
|
||||
|
||||
Only check for gdbm_errno if the return value of the called gdbm_*
|
||||
function says so. This fixes apr-util with gdbm 1.14, which does not
|
||||
seem to always reset gdbm_errno.
|
||||
|
||||
Also make the gdbm driver return error codes starting with
|
||||
APR_OS_START_USEERR instead of always returning APR_EGENERAL. This is
|
||||
what the berkleydb driver already does.
|
||||
|
||||
Also ensure that dsize is 0 if dptr == NULL.
|
||||
|
||||
Upstream-Status: Backport[https://svn.apache.org/viewvc?
|
||||
view=revision&revision=1825311]
|
||||
|
||||
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
||||
---
|
||||
dbm/apr_dbm_gdbm.c | 47 +++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 29 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/dbm/apr_dbm_gdbm.c b/dbm/apr_dbm_gdbm.c
|
||||
index 749447a..1c86327 100644
|
||||
--- a/dbm/apr_dbm_gdbm.c
|
||||
+++ b/dbm/apr_dbm_gdbm.c
|
||||
@@ -36,13 +36,25 @@
|
||||
static apr_status_t g2s(int gerr)
|
||||
{
|
||||
if (gerr == -1) {
|
||||
- /* ### need to fix this */
|
||||
- return APR_EGENERAL;
|
||||
+ if (gdbm_errno == GDBM_NO_ERROR)
|
||||
+ return APR_SUCCESS;
|
||||
+ return APR_OS_START_USEERR + gdbm_errno;
|
||||
}
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
+static apr_status_t gdat2s(datum d)
|
||||
+{
|
||||
+ if (d.dptr == NULL) {
|
||||
+ if (gdbm_errno == GDBM_NO_ERROR || gdbm_errno == GDBM_ITEM_NOT_FOUND)
|
||||
+ return APR_SUCCESS;
|
||||
+ return APR_OS_START_USEERR + gdbm_errno;
|
||||
+ }
|
||||
+
|
||||
+ return APR_SUCCESS;
|
||||
+}
|
||||
+
|
||||
static apr_status_t datum_cleanup(void *dptr)
|
||||
{
|
||||
if (dptr)
|
||||
@@ -53,22 +65,15 @@ static apr_status_t datum_cleanup(void *dptr)
|
||||
|
||||
static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
|
||||
{
|
||||
- apr_status_t rv = APR_SUCCESS;
|
||||
|
||||
- /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
|
||||
+ dbm->errcode = dbm_said;
|
||||
|
||||
- if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) {
|
||||
+ if (dbm_said == APR_SUCCESS)
|
||||
dbm->errmsg = NULL;
|
||||
- }
|
||||
- else {
|
||||
- dbm->errmsg = gdbm_strerror(gdbm_errno);
|
||||
- rv = APR_EGENERAL; /* ### need something better */
|
||||
- }
|
||||
-
|
||||
- /* captured it. clear it now. */
|
||||
- gdbm_errno = GDBM_NO_ERROR;
|
||||
+ else
|
||||
+ dbm->errmsg = gdbm_strerror(dbm_said - APR_OS_START_USEERR);
|
||||
|
||||
- return rv;
|
||||
+ return dbm_said;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
@@ -107,7 +112,7 @@ static apr_status_t vt_gdbm_open(apr_dbm_t **pdb, const char *pathname,
|
||||
NULL);
|
||||
|
||||
if (file == NULL)
|
||||
- return APR_EGENERAL; /* ### need a better error */
|
||||
+ return APR_OS_START_USEERR + gdbm_errno; /* ### need a better error */
|
||||
|
||||
/* we have an open database... return it */
|
||||
*pdb = apr_pcalloc(pool, sizeof(**pdb));
|
||||
@@ -141,10 +146,12 @@ static apr_status_t vt_gdbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
|
||||
if (pvalue->dptr)
|
||||
apr_pool_cleanup_register(dbm->pool, pvalue->dptr, datum_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
+ else
|
||||
+ pvalue->dsize = 0;
|
||||
|
||||
/* store the error info into DBM, and return a status code. Also, note
|
||||
that *pvalue should have been cleared on error. */
|
||||
- return set_error(dbm, APR_SUCCESS);
|
||||
+ return set_error(dbm, gdat2s(rd));
|
||||
}
|
||||
|
||||
static apr_status_t vt_gdbm_store(apr_dbm_t *dbm, apr_datum_t key,
|
||||
@@ -201,9 +208,11 @@ static apr_status_t vt_gdbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey)
|
||||
if (pkey->dptr)
|
||||
apr_pool_cleanup_register(dbm->pool, pkey->dptr, datum_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
+ else
|
||||
+ pkey->dsize = 0;
|
||||
|
||||
/* store any error info into DBM, and return a status code. */
|
||||
- return set_error(dbm, APR_SUCCESS);
|
||||
+ return set_error(dbm, gdat2s(rd));
|
||||
}
|
||||
|
||||
static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
|
||||
@@ -221,9 +230,11 @@ static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
|
||||
if (pkey->dptr)
|
||||
apr_pool_cleanup_register(dbm->pool, pkey->dptr, datum_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
+ else
|
||||
+ pkey->dsize = 0;
|
||||
|
||||
/* store any error info into DBM, and return a status code. */
|
||||
- return set_error(dbm, APR_SUCCESS);
|
||||
+ return set_error(dbm, gdat2s(rd));
|
||||
}
|
||||
|
||||
static void vt_gdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -13,11 +13,9 @@ SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.gz \
|
||||
file://configfix.patch \
|
||||
file://configure_fixes.patch \
|
||||
file://run-ptest \
|
||||
file://0001-Fix-error-handling-in-gdbm.patch \
|
||||
"
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "bd502b9a8670a8012c4d90c31a84955f"
|
||||
SRC_URI[sha256sum] = "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459"
|
||||
SRC_URI[sha256sum] = "2b74d8932703826862ca305b094eef2983c27b39d5c9414442e9976a9acf1983"
|
||||
|
||||
EXTRA_OECONF = "--with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \
|
||||
--without-odbc \
|
||||
@@ -35,6 +33,7 @@ OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
|
||||
do_configure_append() {
|
||||
if [ "${CLASSOVERRIDE}" = "class-target" ]; then
|
||||
cp ${STAGING_DATADIR}/apr/apr_rules.mk ${B}/build/rules.mk
|
||||
sed -i -e 's#^CFLAGS=.*#CFLAGS=${TARGET_CFLAGS}#g' ${B}/build/rules.mk
|
||||
fi
|
||||
}
|
||||
do_configure_prepend_class-native() {
|
||||
@@ -49,6 +48,7 @@ do_configure_append_class-native() {
|
||||
|
||||
do_configure_prepend_class-nativesdk() {
|
||||
cp ${STAGING_DATADIR}/apr/apr_rules.mk ${S}/build/rules.mk
|
||||
sed -i -e 's#^CFLAGS=.*#CFLAGS=${TARGET_CFLAGS}#g' ${S}/build/rules.mk
|
||||
}
|
||||
|
||||
do_configure_append_class-nativesdk() {
|
||||
@@ -1,14 +1,15 @@
|
||||
From 2bbe20b4f69e84e7a18bc79d382486953f479328 Mon Sep 17 00:00:00 2001
|
||||
From 225abf37cd0b49960664b59f08e515a4c4ea5ad0 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Puhlman <jpuhlman@mvista.com>
|
||||
Date: Thu, 26 Mar 2020 18:30:36 +0000
|
||||
Subject: [PATCH] Add option to disable timed dependant tests
|
||||
|
||||
The disabled tests rely on timing to pass correctly. On a virtualized
|
||||
The disabled tests rely on timing to pass correctly. On a virtualized
|
||||
system under heavy load, these tests randomly fail because they miss
|
||||
a timer or other timing related issues.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
|
||||
|
||||
---
|
||||
configure.in | 6 ++++++
|
||||
include/apr.h.in | 1 +
|
||||
@@ -16,10 +17,10 @@ Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
|
||||
3 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index d9f32d6..f0c5661 100644
|
||||
index bfd488b..3663220 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -2886,6 +2886,12 @@ AC_ARG_ENABLE(timedlocks,
|
||||
@@ -3023,6 +3023,12 @@ AC_ARG_ENABLE(timedlocks,
|
||||
)
|
||||
AC_SUBST(apr_has_timedlocks)
|
||||
|
||||
@@ -45,10 +46,10 @@ index ee99def..c46a5f4 100644
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD @apr_procattr_user_set_requires_password@
|
||||
|
||||
diff --git a/test/testlock.c b/test/testlock.c
|
||||
index a43f477..6233d0b 100644
|
||||
index e3437c1..04e01b9 100644
|
||||
--- a/test/testlock.c
|
||||
+++ b/test/testlock.c
|
||||
@@ -396,13 +396,13 @@ abts_suite *testlock(abts_suite *suite)
|
||||
@@ -535,7 +535,7 @@ abts_suite *testlock(abts_suite *suite)
|
||||
abts_run_test(suite, threads_not_impl, NULL);
|
||||
#else
|
||||
abts_run_test(suite, test_thread_mutex, NULL);
|
||||
@@ -56,6 +57,8 @@ index a43f477..6233d0b 100644
|
||||
+#if APR_HAS_TIMEDLOCKS && APR_HAVE_TIME_DEPENDANT_TESTS
|
||||
abts_run_test(suite, test_thread_timedmutex, NULL);
|
||||
#endif
|
||||
abts_run_test(suite, test_thread_nestedmutex, NULL);
|
||||
@@ -543,7 +543,7 @@ abts_suite *testlock(abts_suite *suite)
|
||||
abts_run_test(suite, test_thread_rwlock, NULL);
|
||||
abts_run_test(suite, test_cond, NULL);
|
||||
abts_run_test(suite, test_timeoutcond, NULL);
|
||||
@@ -63,7 +66,4 @@ index a43f477..6233d0b 100644
|
||||
+#if APR_HAS_TIMEDLOCKS && APR_HAVE_TIME_DEPENDANT_TESTS
|
||||
abts_run_test(suite, test_timeoutmutex, NULL);
|
||||
#endif
|
||||
#endif
|
||||
--
|
||||
2.23.0
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From 316b81c462f065927d7fec56aadd5c8cb94d1cf0 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 26 Aug 2022 00:28:08 -0700
|
||||
Subject: [PATCH] configure: Remove runtime test for mmap that can map
|
||||
/dev/zero
|
||||
|
||||
This never works for cross-compile moreover it ends up disabling
|
||||
ac_cv_file__dev_zero which then results in compiler errors in shared
|
||||
mutexes
|
||||
|
||||
Upstream-Status: Inappropriate [Cross-compile specific]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
configure.in | 30 ------------------------------
|
||||
1 file changed, 30 deletions(-)
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 3663220..dce9789 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -1303,36 +1303,6 @@ AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
|
||||
APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
|
||||
AC_CHECK_FILE(/dev/zero)
|
||||
|
||||
-# Not all systems can mmap /dev/zero (such as HP-UX). Check for that.
|
||||
-if test "$ac_cv_func_mmap" = "yes" &&
|
||||
- test "$ac_cv_file__dev_zero" = "yes"; then
|
||||
- AC_CACHE_CHECK([for mmap that can map /dev/zero],
|
||||
- [ac_cv_mmap__dev_zero],
|
||||
- [AC_TRY_RUN([#include <sys/types.h>
|
||||
-#include <sys/stat.h>
|
||||
-#include <fcntl.h>
|
||||
-#ifdef HAVE_SYS_MMAN_H
|
||||
-#include <sys/mman.h>
|
||||
-#endif
|
||||
- int main()
|
||||
- {
|
||||
- int fd;
|
||||
- void *m;
|
||||
- fd = open("/dev/zero", O_RDWR);
|
||||
- if (fd < 0) {
|
||||
- return 1;
|
||||
- }
|
||||
- m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
- if (m == (void *)-1) { /* aka MAP_FAILED */
|
||||
- return 2;
|
||||
- }
|
||||
- if (munmap(m, sizeof(void*)) < 0) {
|
||||
- return 3;
|
||||
- }
|
||||
- return 0;
|
||||
- }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])])
|
||||
-fi
|
||||
-
|
||||
# Now we determine which one is our anonymous shmem preference.
|
||||
haveshmgetanon="0"
|
||||
havemmapzero="0"
|
||||
@@ -1,8 +1,7 @@
|
||||
From 5925b20da8bbc34d9bf5a5dca123ef38864d43c6 Mon Sep 17 00:00:00 2001
|
||||
From 689a8db96a6d1e1cae9cbfb35d05ac82140a6555 Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Tue, 30 Jan 2018 09:39:06 +0800
|
||||
Subject: [PATCH 2/7] apr: Remove workdir path references from installed apr
|
||||
files
|
||||
Subject: [PATCH] apr: Remove workdir path references from installed apr files
|
||||
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
|
||||
@@ -14,20 +13,23 @@ packages at target run time, the workdir path caused confusion.
|
||||
Rebase to 1.6.3
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
|
||||
---
|
||||
apr-config.in | 26 ++------------------------
|
||||
1 file changed, 2 insertions(+), 24 deletions(-)
|
||||
apr-config.in | 32 ++------------------------------
|
||||
1 file changed, 2 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/apr-config.in b/apr-config.in
|
||||
index 84b4073..bbbf651 100644
|
||||
index bed47ca..47874e5 100644
|
||||
--- a/apr-config.in
|
||||
+++ b/apr-config.in
|
||||
@@ -152,14 +152,7 @@ while test $# -gt 0; do
|
||||
@@ -164,16 +164,7 @@ while test $# -gt 0; do
|
||||
flags="$flags $LDFLAGS"
|
||||
;;
|
||||
--includes)
|
||||
- if test "$location" = "installed"; then
|
||||
flags="$flags -I$includedir $EXTRA_INCLUDES"
|
||||
- elif test "$location" = "crosscompile"; then
|
||||
- flags="$flags -I$APR_TARGET_DIR/$includedir $EXTRA_INCLUDES"
|
||||
- elif test "$location" = "source"; then
|
||||
- flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
|
||||
- else
|
||||
@@ -37,13 +39,15 @@ index 84b4073..bbbf651 100644
|
||||
;;
|
||||
--srcdir)
|
||||
echo $APR_SOURCE_DIR
|
||||
@@ -181,29 +174,14 @@ while test $# -gt 0; do
|
||||
@@ -197,33 +188,14 @@ while test $# -gt 0; do
|
||||
exit 0
|
||||
;;
|
||||
--link-ld)
|
||||
- if test "$location" = "installed"; then
|
||||
- ### avoid using -L if libdir is a "standard" location like /usr/lib
|
||||
- flags="$flags -L$libdir -l${APR_LIBNAME}"
|
||||
- elif test "$location" = "crosscompile"; then
|
||||
- flags="$flags -L$APR_TARGET_DIR/$libdir -l${APR_LIBNAME}"
|
||||
- else
|
||||
- ### this surely can't work since the library is in .libs?
|
||||
- flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
|
||||
@@ -62,6 +66,8 @@ index 84b4073..bbbf651 100644
|
||||
- # Since the user is specifying they are linking with libtool, we
|
||||
- # *know* that -R will be recognized by libtool.
|
||||
- flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
|
||||
- elif test "$location" = "crosscompile"; then
|
||||
- flags="$flags -L${APR_TARGET_DIR}/$libdir -l${APR_LIBNAME}"
|
||||
- else
|
||||
- flags="$flags $LA_FILE"
|
||||
- fi
|
||||
@@ -69,6 +75,3 @@ index 84b4073..bbbf651 100644
|
||||
;;
|
||||
--shlib-path-var)
|
||||
echo "$SHLIBPATH_VAR"
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
From d5028c10f156c224475b340cfb1ba025d6797243 Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Fri, 2 Feb 2018 15:51:42 +0800
|
||||
Subject: [PATCH 3/7] Makefile.in/configure.in: support cross compiling
|
||||
|
||||
While cross compiling, the tools/gen_test_char could not
|
||||
be executed at build time, use AX_PROG_CC_FOR_BUILD to
|
||||
build native tools/gen_test_char
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/apache/apr/pull/8]
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
Makefile.in | 10 +++-------
|
||||
configure.in | 3 +++
|
||||
2 files changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 5fb760e..8675f90 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -46,7 +46,7 @@ LT_VERSION = @LT_VERSION@
|
||||
|
||||
CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
|
||||
build/apr_rules.out tools/gen_test_char@EXEEXT@ \
|
||||
- tools/gen_test_char.o tools/gen_test_char.lo \
|
||||
+ tools/gen_test_char.o \
|
||||
include/private/apr_escape_test_char.h
|
||||
DISTCLEAN_TARGETS = config.cache config.log config.status \
|
||||
include/apr.h include/arch/unix/apr_private.h \
|
||||
@@ -131,13 +131,9 @@ check: $(TARGET_LIB)
|
||||
etags:
|
||||
etags `find . -name '*.[ch]'`
|
||||
|
||||
-OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS)
|
||||
-tools/gen_test_char.lo: tools/gen_test_char.c
|
||||
+tools/gen_test_char@EXEEXT@: tools/gen_test_char.c
|
||||
$(APR_MKDIR) tools
|
||||
- $(LT_COMPILE)
|
||||
-
|
||||
-tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
|
||||
- $(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
|
||||
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $< -o $@
|
||||
|
||||
include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
|
||||
$(APR_MKDIR) include/private
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 719f331..361120f 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -183,6 +183,9 @@ dnl can only be used once within a configure script, so this prevents a
|
||||
dnl preload section from invoking the macro to get compiler info.
|
||||
AC_PROG_CC
|
||||
|
||||
+dnl Check build CC for gen_test_char compiling which is executed at build time.
|
||||
+AX_PROG_CC_FOR_BUILD
|
||||
+
|
||||
dnl AC_PROG_SED is only avaliable in recent autoconf versions.
|
||||
dnl Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
|
||||
ifdef([AC_PROG_SED],
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
From 49661ea3858cf8494926cccf57d3e8c6dcb47117 Mon Sep 17 00:00:00 2001
|
||||
From: Dengke Du <dengke.du@windriver.com>
|
||||
Date: Wed, 14 Dec 2016 18:13:08 +0800
|
||||
Subject: [PATCH] apr: fix off_t size doesn't match in glibc when cross
|
||||
compiling
|
||||
|
||||
In configure.in, it contains the following:
|
||||
|
||||
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
|
||||
|
||||
the macro "APR_CHECK_SIZEOF_EXTENDED" was defined in build/apr_common.m4,
|
||||
it use the "AC_TRY_RUN" macro, this macro let the off_t to 8, when cross
|
||||
compiling enable.
|
||||
|
||||
So it was hardcoded for cross compiling, we should detect it dynamic based on
|
||||
the sysroot's glibc. We change it to the following:
|
||||
|
||||
AC_CHECK_SIZEOF(off_t)
|
||||
|
||||
The same for the following hardcoded types for cross compiling:
|
||||
|
||||
pid_t 8
|
||||
ssize_t 8
|
||||
size_t 8
|
||||
off_t 8
|
||||
|
||||
Change the above correspondingly.
|
||||
|
||||
Signed-off-by: Dengke Du <dengke.du@windriver.com>
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
---
|
||||
configure.in | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 27b8539..fb408d1 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -1801,7 +1801,7 @@ else
|
||||
socklen_t_value="int"
|
||||
fi
|
||||
|
||||
-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
|
||||
+AC_CHECK_SIZEOF(pid_t)
|
||||
|
||||
if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
|
||||
pid_t_fmt='#define APR_PID_T_FMT "hd"'
|
||||
@@ -1873,7 +1873,7 @@ APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned long, lu, [size_t_fmt="lu"], [
|
||||
APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"])
|
||||
])
|
||||
|
||||
-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
|
||||
+AC_CHECK_SIZEOF(ssize_t)
|
||||
|
||||
dnl the else cases below should no longer occur;
|
||||
AC_MSG_CHECKING([which format to use for apr_ssize_t])
|
||||
@@ -1891,7 +1891,7 @@ fi
|
||||
|
||||
ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
|
||||
|
||||
-APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
|
||||
+AC_CHECK_SIZEOF(size_t)
|
||||
|
||||
# else cases below should no longer occur;
|
||||
AC_MSG_CHECKING([which format to use for apr_size_t])
|
||||
@@ -1909,7 +1909,7 @@ fi
|
||||
|
||||
size_t_fmt="#define APR_SIZE_T_FMT \"$size_t_fmt\""
|
||||
|
||||
-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
|
||||
+AC_CHECK_SIZEOF(off_t)
|
||||
|
||||
if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
|
||||
# Enable LFS
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
SECURITY: CVE-2021-35940 (cve.mitre.org)
|
||||
|
||||
Restore fix for CVE-2017-12613 which was missing in 1.7.x branch, though
|
||||
was addressed in 1.6.x in 1.6.3 and later via r1807976.
|
||||
|
||||
The fix was merged back to 1.7.x in r1891198.
|
||||
|
||||
Since this was a regression in 1.7.0, a new CVE name has been assigned
|
||||
to track this, CVE-2021-35940.
|
||||
|
||||
Thanks to Iveta Cesalova <icesalov redhat.com> for reporting this issue.
|
||||
|
||||
https://svn.apache.org/viewvc?view=revision&revision=1891198
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2021-35940
|
||||
Signed-off-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
|
||||
Index: time/unix/time.c
|
||||
===================================================================
|
||||
--- a/time/unix/time.c (revision 1891197)
|
||||
+++ b/time/unix/time.c (revision 1891198)
|
||||
@@ -142,6 +142,9 @@
|
||||
static const int dayoffset[12] =
|
||||
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
|
||||
|
||||
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
|
||||
+ return APR_EBADDATE;
|
||||
+
|
||||
/* shift new year to 1st March in order to make leap year calc easy */
|
||||
|
||||
if (xt->tm_mon < 2)
|
||||
Index: time/win32/time.c
|
||||
===================================================================
|
||||
--- a/time/win32/time.c (revision 1891197)
|
||||
+++ b/time/win32/time.c (revision 1891198)
|
||||
@@ -54,6 +54,9 @@
|
||||
static const int dayoffset[12] =
|
||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
|
||||
|
||||
+ if (tm->wMonth < 1 || tm->wMonth > 12)
|
||||
+ return APR_EBADDATE;
|
||||
+
|
||||
/* Note; the caller is responsible for filling in detailed tm_usec,
|
||||
* tm_gmtoff and tm_isdst data when applicable.
|
||||
*/
|
||||
@@ -228,6 +231,9 @@
|
||||
static const int dayoffset[12] =
|
||||
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
|
||||
|
||||
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
|
||||
+ return APR_EBADDATE;
|
||||
+
|
||||
/* shift new year to 1st March in order to make leap year calc easy */
|
||||
|
||||
if (xt->tm_mon < 2)
|
||||
@@ -1,6 +1,7 @@
|
||||
From 17835709bc55657b7af1f7c99b3f572b819cf97e Mon Sep 17 00:00:00 2001
|
||||
From: Helmut Grohne <helmut@subdivi.de>
|
||||
Subject: check for libtoolize rather than libtool
|
||||
Last-Update: 2014-09-19
|
||||
Date: Tue, 7 Feb 2023 07:04:00 +0000
|
||||
Subject: [PATCH] check for libtoolize rather than libtool
|
||||
|
||||
libtool is now in package libtool-bin, but apr only needs libtoolize.
|
||||
|
||||
@@ -8,14 +9,22 @@ Upstream-Status: Pending [ from debian: https://sources.debian.org/data/main/a/a
|
||||
|
||||
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
|
||||
|
||||
--- apr.orig/build/buildcheck.sh
|
||||
+++ apr/build/buildcheck.sh
|
||||
@@ -39,11 +39,11 @@ fi
|
||||
---
|
||||
build/buildcheck.sh | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/build/buildcheck.sh b/build/buildcheck.sh
|
||||
index 44921b5..08bc8a8 100755
|
||||
--- a/build/buildcheck.sh
|
||||
+++ b/build/buildcheck.sh
|
||||
@@ -39,13 +39,11 @@ fi
|
||||
# ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
|
||||
# output is multiline from 1.5 onwards
|
||||
|
||||
-# Require libtool 1.4 or newer
|
||||
-libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14`
|
||||
-if test -z "$libtool"; then
|
||||
- libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14`
|
||||
-fi
|
||||
-lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
|
||||
+# Require libtoolize 1.4 or newer
|
||||
+libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize libtoolize15 libtoolize14`
|
||||
|
||||
@@ -16,18 +16,15 @@ BBCLASSEXTEND = "native nativesdk"
|
||||
SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.bz2 \
|
||||
file://run-ptest \
|
||||
file://0002-apr-Remove-workdir-path-references-from-installed-ap.patch \
|
||||
file://0003-Makefile.in-configure.in-support-cross-compiling.patch \
|
||||
file://0004-Fix-packet-discards-HTTP-redirect.patch \
|
||||
file://0005-configure.in-fix-LTFLAGS-to-make-it-work-with-ccache.patch \
|
||||
file://0006-apr-fix-off_t-size-doesn-t-match-in-glibc-when-cross.patch \
|
||||
file://0007-explicitly-link-libapr-against-phtread-to-make-gold-.patch \
|
||||
file://libtoolize_check.patch \
|
||||
file://0001-Add-option-to-disable-timed-dependant-tests.patch \
|
||||
file://CVE-2021-35940.patch \
|
||||
file://0001-configure-Remove-runtime-test-for-mmap-that-can-map-.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "7a14a83d664e87599ea25ff4432e48a7"
|
||||
SRC_URI[sha256sum] = "e2e148f0b2e99b8e5c6caa09f6d4fb4dd3e83f744aa72a952f94f5a14436f7ea"
|
||||
SRC_URI[sha256sum] = "75e77cc86776c030c0a5c408dfbd0bf2a0b75eed5351e52d5439fa1e5509a43e"
|
||||
|
||||
inherit autotools-brokensep lib_package binconfig multilib_header ptest multilib_script
|
||||
|
||||
@@ -35,17 +32,30 @@ OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
|
||||
|
||||
# Added to fix some issues with cmake. Refer to https://github.com/bmwcarit/meta-ros/issues/68#issuecomment-19896928
|
||||
CACHED_CONFIGUREVARS += "apr_cv_mutex_recursive=yes"
|
||||
|
||||
# Enable largefile
|
||||
CACHED_CONFIGUREVARS += "apr_cv_use_lfs64=yes"
|
||||
# Additional AC_TRY_RUN tests which will need to be cached for cross compile
|
||||
CACHED_CONFIGUREVARS += "apr_cv_epoll=yes epoll_create1=yes apr_cv_sock_cloexec=yes \
|
||||
ac_cv_struct_rlimit=yes \
|
||||
ac_cv_func_sem_open=yes \
|
||||
apr_cv_process_shared_works=yes \
|
||||
apr_cv_mutex_robust_shared=yes \
|
||||
"
|
||||
# Also suppress trying to use sctp.
|
||||
#
|
||||
CACHED_CONFIGUREVARS += "ac_cv_header_netinet_sctp_h=no ac_cv_header_netinet_sctp_uio_h=no"
|
||||
|
||||
CACHED_CONFIGUREVARS += "ac_cv_sizeof_struct_iovec=yes"
|
||||
# ac_cv_sizeof_struct_iovec is deduced using runtime check which will fail during cross-compile
|
||||
CACHED_CONFIGUREVARS += "${@['ac_cv_sizeof_struct_iovec=16','ac_cv_sizeof_struct_iovec=8'][d.getVar('SITEINFO_BITS') != '32']}"
|
||||
|
||||
CACHED_CONFIGUREVARS += "ac_cv_file__dev_zero=yes"
|
||||
|
||||
CACHED_CONFIGUREVARS:append:libc-musl = " ac_cv_strerror_r_rc_int=yes"
|
||||
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
|
||||
PACKAGECONFIG:append:libc-musl = " xsi-strerror"
|
||||
PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
|
||||
PACKAGECONFIG[timed-tests] = "--enable-timed-tests,--disable-timed-tests,"
|
||||
PACKAGECONFIG[xsi-strerror] = "ac_cv_strerror_r_rc_int=yes,ac_cv_strerror_r_rc_int=no,"
|
||||
|
||||
do_configure_prepend() {
|
||||
# Avoid absolute paths for grep since it causes failures
|
||||
82
meta/recipes-support/curl/curl/CVE-2022-43552.patch
Normal file
82
meta/recipes-support/curl/curl/CVE-2022-43552.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
rom 4f20188ac644afe174be6005ef4f6ffba232b8b2 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 19 Dec 2022 08:38:37 +0100
|
||||
Subject: [PATCH] smb/telnet: do not free the protocol struct in *_done()
|
||||
|
||||
It is managed by the generic layer.
|
||||
|
||||
Reported-by: Trail of Bits
|
||||
|
||||
Closes #10112
|
||||
|
||||
CVE: CVE-2022-43552
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/4f20188ac644afe174be6005ef4f6ffba232b8b2]
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
lib/smb.c | 14 ++------------
|
||||
lib/telnet.c | 3 ---
|
||||
2 files changed, 2 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/lib/smb.c b/lib/smb.c
|
||||
index 12f9925..8db3b27 100644
|
||||
--- a/lib/smb.c
|
||||
+++ b/lib/smb.c
|
||||
@@ -61,8 +61,6 @@ static CURLcode smb_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode smb_connection_state(struct connectdata *conn, bool *done);
|
||||
static CURLcode smb_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode smb_request_state(struct connectdata *conn, bool *done);
|
||||
-static CURLcode smb_done(struct connectdata *conn, CURLcode status,
|
||||
- bool premature);
|
||||
static CURLcode smb_disconnect(struct connectdata *conn, bool dead);
|
||||
static int smb_getsock(struct connectdata *conn, curl_socket_t *socks);
|
||||
static CURLcode smb_parse_url_path(struct connectdata *conn);
|
||||
@@ -74,7 +72,7 @@ const struct Curl_handler Curl_handler_smb = {
|
||||
"SMB", /* scheme */
|
||||
smb_setup_connection, /* setup_connection */
|
||||
smb_do, /* do_it */
|
||||
- smb_done, /* done */
|
||||
+ ZERO_NULL, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
smb_connect, /* connect_it */
|
||||
smb_connection_state, /* connecting */
|
||||
@@ -99,7 +97,7 @@ const struct Curl_handler Curl_handler_smbs = {
|
||||
"SMBS", /* scheme */
|
||||
smb_setup_connection, /* setup_connection */
|
||||
smb_do, /* do_it */
|
||||
- smb_done, /* done */
|
||||
+ ZERO_NULL, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
smb_connect, /* connect_it */
|
||||
smb_connection_state, /* connecting */
|
||||
@@ -919,14 +917,6 @@ static CURLcode smb_request_state(struct connectdata *conn, bool *done)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
-static CURLcode smb_done(struct connectdata *conn, CURLcode status,
|
||||
- bool premature)
|
||||
-{
|
||||
- (void) premature;
|
||||
- Curl_safefree(conn->data->req.protop);
|
||||
- return status;
|
||||
-}
|
||||
-
|
||||
static CURLcode smb_disconnect(struct connectdata *conn, bool dead)
|
||||
{
|
||||
struct smb_conn *smbc = &conn->proto.smbc;
|
||||
diff --git a/lib/telnet.c b/lib/telnet.c
|
||||
index 3347ad6..e3b9208 100644
|
||||
--- a/lib/telnet.c
|
||||
+++ b/lib/telnet.c
|
||||
@@ -1294,9 +1294,6 @@ static CURLcode telnet_done(struct connectdata *conn,
|
||||
|
||||
curl_slist_free_all(tn->telnet_vars);
|
||||
tn->telnet_vars = NULL;
|
||||
-
|
||||
- Curl_safefree(conn->data->req.protop);
|
||||
-
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -41,6 +41,7 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
|
||||
file://CVE-2022-35252.patch \
|
||||
file://CVE-2022-32221.patch \
|
||||
file://CVE-2022-35260.patch \
|
||||
file://CVE-2022-43552.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"
|
||||
|
||||
85
meta/recipes-support/gnutls/gnutls/CVE-2023-0361.patch
Normal file
85
meta/recipes-support/gnutls/gnutls/CVE-2023-0361.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
From 80a6ce8ddb02477cd724cd5b2944791aaddb702a Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Sosedkin <asosedkin@redhat.com>
|
||||
Date: Tue, 9 Aug 2022 16:05:53 +0200
|
||||
Subject: [PATCH] auth/rsa: side-step potential side-channel
|
||||
|
||||
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
|
||||
Signed-off-by: Hubert Kario <hkario@redhat.com>
|
||||
Tested-by: Hubert Kario <hkario@redhat.com>
|
||||
Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/80a6ce8ddb02477cd724cd5b2944791aaddb702a
|
||||
https://gitlab.com/gnutls/gnutls/-/commit/4b7ff428291c7ed77c6d2635577c83a43bbae558]
|
||||
CVE: CVE-2023-0361
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
lib/auth/rsa.c | 30 +++---------------------------
|
||||
1 file changed, 3 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
|
||||
index 8108ee8..858701f 100644
|
||||
--- a/lib/auth/rsa.c
|
||||
+++ b/lib/auth/rsa.c
|
||||
@@ -155,13 +155,10 @@ static int
|
||||
proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
|
||||
size_t _data_size)
|
||||
{
|
||||
- const char attack_error[] = "auth_rsa: Possible PKCS #1 attack\n";
|
||||
gnutls_datum_t ciphertext;
|
||||
int ret, dsize;
|
||||
ssize_t data_size = _data_size;
|
||||
volatile uint8_t ver_maj, ver_min;
|
||||
- volatile uint8_t check_ver_min;
|
||||
- volatile uint32_t ok;
|
||||
|
||||
#ifdef ENABLE_SSL3
|
||||
if (get_num_version(session) == GNUTLS_SSL3) {
|
||||
@@ -187,7 +184,6 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
|
||||
|
||||
ver_maj = _gnutls_get_adv_version_major(session);
|
||||
ver_min = _gnutls_get_adv_version_minor(session);
|
||||
- check_ver_min = (session->internals.allow_wrong_pms == 0);
|
||||
|
||||
session->key.key.data = gnutls_malloc(GNUTLS_MASTER_SIZE);
|
||||
if (session->key.key.data == NULL) {
|
||||
@@ -206,10 +202,9 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- ret =
|
||||
- gnutls_privkey_decrypt_data2(session->internals.selected_key,
|
||||
- 0, &ciphertext, session->key.key.data,
|
||||
- session->key.key.size);
|
||||
+ gnutls_privkey_decrypt_data2(session->internals.selected_key,
|
||||
+ 0, &ciphertext, session->key.key.data,
|
||||
+ session->key.key.size);
|
||||
/* After this point, any conditional on failure that cause differences
|
||||
* in execution may create a timing or cache access pattern side
|
||||
* channel that can be used as an oracle, so treat very carefully */
|
||||
@@ -225,25 +220,6 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
|
||||
* Vlastimil Klima, Ondej Pokorny and Tomas Rosa.
|
||||
*/
|
||||
|
||||
- /* ok is 0 in case of error and 1 in case of success. */
|
||||
-
|
||||
- /* if ret < 0 */
|
||||
- ok = CONSTCHECK_EQUAL(ret, 0);
|
||||
- /* session->key.key.data[0] must equal ver_maj */
|
||||
- ok &= CONSTCHECK_EQUAL(session->key.key.data[0], ver_maj);
|
||||
- /* if check_ver_min then session->key.key.data[1] must equal ver_min */
|
||||
- ok &= CONSTCHECK_NOT_EQUAL(check_ver_min, 0) &
|
||||
- CONSTCHECK_EQUAL(session->key.key.data[1], ver_min);
|
||||
-
|
||||
- if (ok) {
|
||||
- /* call logging function unconditionally so all branches are
|
||||
- * indistinguishable for timing and cache access when debug
|
||||
- * logging is disabled */
|
||||
- _gnutls_no_log("%s", attack_error);
|
||||
- } else {
|
||||
- _gnutls_debug_log("%s", attack_error);
|
||||
- }
|
||||
-
|
||||
/* This is here to avoid the version check attack
|
||||
* discussed above.
|
||||
*/
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -27,6 +27,7 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
|
||||
file://CVE-2021-20232.patch \
|
||||
file://CVE-2022-2509.patch \
|
||||
file://CVE-2021-4209.patch \
|
||||
file://CVE-2023-0361.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "5630751adec7025b8ef955af4d141d00d252a985769f51b4059e5affa3d39d63"
|
||||
|
||||
@@ -20,8 +20,8 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
|
||||
file://no-path-adjust.patch \
|
||||
"
|
||||
|
||||
PV .= ".1211"
|
||||
SRCREV = "f7d1c6e1884c76680980571f1cf15e0928d247b5"
|
||||
PV .= ".1293"
|
||||
SRCREV = "0caaf1e46511f7a92e036f05e6aa9d5992540117"
|
||||
|
||||
# Remove when 8.3 is out
|
||||
UPSTREAM_VERSION_UNKNOWN = "1"
|
||||
@@ -33,7 +33,7 @@ S = "${WORKDIR}/git"
|
||||
|
||||
VIMDIR = "vim${@d.getVar('PV').split('.')[0]}${@d.getVar('PV').split('.')[1]}"
|
||||
|
||||
inherit autotools-brokensep update-alternatives mime-xdg
|
||||
inherit autotools-brokensep update-alternatives mime-xdg pkgconfig
|
||||
|
||||
CLEANBROKEN = "1"
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ def menuconfig(args, config, basepath, workspace):
|
||||
return 1
|
||||
|
||||
check_workspace_recipe(workspace, args.component)
|
||||
pn = rd.getVar('PN', True)
|
||||
pn = rd.getVar('PN')
|
||||
|
||||
if not rd.getVarFlag('do_menuconfig','task'):
|
||||
raise DevtoolError("This recipe does not support menuconfig option")
|
||||
|
||||
27
scripts/nativesdk-intercept/chgrp
Executable file
27
scripts/nativesdk-intercept/chgrp
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Wrapper around 'chgrp' that redirects to root in all cases
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
# calculate path to the real 'chgrp'
|
||||
path = os.environ['PATH']
|
||||
path = path.replace(os.path.dirname(sys.argv[0]), '')
|
||||
real_chgrp = shutil.which('chgrp', path=path)
|
||||
|
||||
args = list()
|
||||
|
||||
found = False
|
||||
for i in sys.argv:
|
||||
if i.startswith("-"):
|
||||
args.append(i)
|
||||
continue
|
||||
if not found:
|
||||
args.append("root")
|
||||
found = True
|
||||
else:
|
||||
args.append(i)
|
||||
|
||||
os.execv(real_chgrp, args)
|
||||
27
scripts/nativesdk-intercept/chown
Executable file
27
scripts/nativesdk-intercept/chown
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Wrapper around 'chown' that redirects to root in all cases
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
# calculate path to the real 'chown'
|
||||
path = os.environ['PATH']
|
||||
path = path.replace(os.path.dirname(sys.argv[0]), '')
|
||||
real_chown = shutil.which('chown', path=path)
|
||||
|
||||
args = list()
|
||||
|
||||
found = False
|
||||
for i in sys.argv:
|
||||
if i.startswith("-"):
|
||||
args.append(i)
|
||||
continue
|
||||
if not found:
|
||||
args.append("root:root")
|
||||
found = True
|
||||
else:
|
||||
args.append(i)
|
||||
|
||||
os.execv(real_chown, args)
|
||||
Reference in New Issue
Block a user