Skip to content
Snippets Groups Projects
Commit ab8d0f16 authored by Marian Buschsieweke's avatar Marian Buschsieweke Committed by Francesco Colista
Browse files

community/v4l-utils: fix segfault and url

- update upstream URL
- add a fix for parse_next_subopt() to no longer rely on glibc specific
  implementation of getsubopt(). As result, `v4l2-ctl -c foo=bar` will
  no longer segfault
parent 1d70c21d
No related merge requests found
......@@ -2,9 +2,9 @@
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=v4l-utils
pkgver=1.22.1
pkgrel=0
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
......@@ -12,6 +12,7 @@ makedepends="qt5-qtbase-dev libjpeg-turbo-dev argp-standalone linux-headers
subpackages="$pkgname-dev $pkgname-doc qv4l2 $pkgname-dvbv5 $pkgname-libs ir_keytable"
source="https://linuxtv.org/downloads/v4l-utils/v4l-utils-$pkgver.tar.bz2
types.patch
fix_parse_next_subopt.patch
"
build() {
export CFLAGS="$CFLAGS -D__off_t=off_t"
......@@ -84,4 +85,5 @@ ir_keytable() {
sha512sums="
8a634d8995d13f453dfaf90ca5d0dfb26f2f4b10a0d200d76a949c46f77040d12fc0a5b35e05d7b1ba68bcfc85a445be5a5ab1d4a7d4eabfe3a254038ccc6170 v4l-utils-1.22.1.tar.bz2
358611fbae8348f17bf49c08820b4641deb1f7282ce2c1e20b8fdf0a85cd73ca4b46f6668c2a7328b5261e401c12f471170a9a1f3fc2982b6897ff11386c06c6 types.patch
75834c6a1b9ee102b16baac1e0e57e33506e44e6e57a641dcdd4e83112d0150d84feeb0781a63a85255acc703ebace8c5136be93a0be1e141afeb68d043b100a fix_parse_next_subopt.patch
"
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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment