aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-08-08 17:35:55 +0200
committerAnton Khirnov <anton@khirnov.net>2024-09-15 22:21:17 +0200
commit00f5a34c9a5f0adee28aca11971918d6aca48745 (patch)
tree56745fc2e9015f7f14368b7b06b25eb1be0eb2a8
parent8707c8660d4ba9376b7e08b69c29486036c34212 (diff)
downloadffmpeg-00f5a34c9a5f0adee28aca11971918d6aca48745.tar.gz
fftools/cmdutils: tighten condition for media type stream specifiers
Require the character indicating media type to be followed by a non-alphanumeric character (or end of string). Needed by future syntax extensions.
-rw-r--r--fftools/cmdutils.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index a9a7ff4194..1573106d8b 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -988,6 +988,12 @@ FILE *get_preset_file(char *filename, size_t filename_size,
return f;
}
+static int cmdutils_isalnum(char c)
+{
+ return (c >= '0' && c <= '9') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= 'a' && c <= 'z');
+}
void stream_specifier_uninit(StreamSpecifier *ss)
{
@@ -1024,8 +1030,9 @@ int stream_specifier_parse(StreamSpecifier *ss, const char *spec,
// this terminates the specifier
break;
- } else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
- *spec == 't' || *spec == 'V') { /* opt:[vasdtV] */
+ } else if ((*spec == 'v' || *spec == 'a' || *spec == 's' ||
+ *spec == 'd' || *spec == 't' || *spec == 'V') &&
+ !cmdutils_isalnum(*(spec + 1))) { /* opt:[vasdtV] */
if (ss->media_type != AVMEDIA_TYPE_UNKNOWN) {
av_log(logctx, AV_LOG_ERROR, "Stream type specified multiple times\n");
ret = AVERROR(EINVAL);