aboutsummaryrefslogtreecommitdiffstats
path: root/community/v4l-utils
diff options
context:
space:
mode:
Diffstat (limited to 'community/v4l-utils')
-rw-r--r--community/v4l-utils/APKBUILD16
-rw-r--r--community/v4l-utils/fix_parse_next_subopt.patch36
-rw-r--r--community/v4l-utils/getsubopt.patch33
3 files changed, 45 insertions, 40 deletions
diff --git a/community/v4l-utils/APKBUILD b/community/v4l-utils/APKBUILD
index e76e499960..bdff6a9b52 100644
--- a/community/v4l-utils/APKBUILD
+++ b/community/v4l-utils/APKBUILD
@@ -1,18 +1,18 @@
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=v4l-utils
-pkgver=1.20.0
-pkgrel=0
+pkgver=1.22.1
+pkgrel=1
pkgdesc="Userspace tools and conversion library for Video 4 Linux"
-url="http://freshmeat.net/projects/libv4l"
+url="https://linuxtv.org/"
arch="all"
license="LGPL-2.0-or-later"
makedepends="qt5-qtbase-dev libjpeg-turbo-dev argp-standalone linux-headers
eudev-dev alsa-lib-dev"
subpackages="$pkgname-dev $pkgname-doc qv4l2 $pkgname-dvbv5 $pkgname-libs ir_keytable"
source="https://linuxtv.org/downloads/v4l-utils/v4l-utils-$pkgver.tar.bz2
- getsubopt.patch
types.patch
+ fix_parse_next_subopt.patch
"
build() {
export CFLAGS="$CFLAGS -D__off_t=off_t"
@@ -82,6 +82,8 @@ ir_keytable() {
"$subpkgdir"/etc
}
-sha512sums="179ca8dbbf7af5fa4870b70f17645d7834fe6ba52670ae6b58473efa257db0cd812ce14f16574cc4491c0bcb218835e4c29f1354882a151687eecec97852fc63 v4l-utils-1.20.0.tar.bz2
-3e51af7a77a8f06e1278022362347808b233cf021a277ce9cd66a9553e754bf91b3923c32ab17a86b11f4ef2555a5f1d544d0fc22e82a2997e34060dd561f760 getsubopt.patch
-358611fbae8348f17bf49c08820b4641deb1f7282ce2c1e20b8fdf0a85cd73ca4b46f6668c2a7328b5261e401c12f471170a9a1f3fc2982b6897ff11386c06c6 types.patch"
+sha512sums="
+8a634d8995d13f453dfaf90ca5d0dfb26f2f4b10a0d200d76a949c46f77040d12fc0a5b35e05d7b1ba68bcfc85a445be5a5ab1d4a7d4eabfe3a254038ccc6170 v4l-utils-1.22.1.tar.bz2
+358611fbae8348f17bf49c08820b4641deb1f7282ce2c1e20b8fdf0a85cd73ca4b46f6668c2a7328b5261e401c12f471170a9a1f3fc2982b6897ff11386c06c6 types.patch
+75834c6a1b9ee102b16baac1e0e57e33506e44e6e57a641dcdd4e83112d0150d84feeb0781a63a85255acc703ebace8c5136be93a0be1e141afeb68d043b100a fix_parse_next_subopt.patch
+"
diff --git a/community/v4l-utils/fix_parse_next_subopt.patch b/community/v4l-utils/fix_parse_next_subopt.patch
new file mode 100644
index 0000000000..d4df9d4a3a
--- /dev/null
+++ b/community/v4l-utils/fix_parse_next_subopt.patch
@@ -0,0 +1,36 @@
+parse_next_subopt() relies on undefined behavior and only works with glibc's
+implementation of getsubopt(). This fixes the issue.
+--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp 2021-11-08 11:23:39.079748359 +0100
++++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp 2021-11-08 11:39:49.328576794 +0100
+@@ -956,15 +956,23 @@ static bool parse_subset(char *optarg)
+
+ static bool parse_next_subopt(char **subs, char **value)
+ {
+- static char *const subopts[] = {
+- nullptr
+- };
+- int opt = getsubopt(subs, subopts, value);
++ char *start = *subs;
++ if (!start || (start[0] == '\0')) {
++ fprintf(stderr, "Missing suboption value\n");
++ return true;
++ }
++ *value = start;
+
+- if (opt < 0 || *value)
+- return false;
+- fprintf(stderr, "Missing suboption value\n");
+- return true;
++ char *sep = std::strchr(start, ',');
++ if (sep != nullptr) {
++ *sep = '\0';
++ *subs = sep + 1;
++ }
++ else {
++ *subs = std::strchr(start, '\0');
++ }
++
++ return false;
+ }
+
+ void common_cmd(const std::string &media_bus_info, int ch, char *optarg)
diff --git a/community/v4l-utils/getsubopt.patch b/community/v4l-utils/getsubopt.patch
deleted file mode 100644
index 8ac87a8c7a..0000000000
--- a/community/v4l-utils/getsubopt.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-POSIX says that behavior when subopts list is empty is undefined.
-musl libs will set value to NULL which leads to crash.
-
-Simply avoid getsubopt, since we cannot rely on it.
-
---- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
-+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
-@@ -782,15 +782,17 @@
-
- static bool parse_next_subopt(char **subs, char **value)
- {
-- static char *const subopts[] = {
-- NULL
-- };
-- int opt = getsubopt(subs, subopts, value);
-+ char *p = *subs;
-+ *value = *subs;
-
-- if (opt < 0 || *value)
-- return false;
-- fprintf(stderr, "Missing suboption value\n");
-- return true;
-+ while (*p && *p != ',')
-+ p++;
-+
-+ if (*p)
-+ *p++ = '\0';
-+
-+ *subs = p;
-+ return false;
- }
-
- void common_cmd(const std::string &media_bus_info, int ch, char *optarg)