From patchwork Thu Jun 1 11:44:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3781 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp726940vsk; Thu, 1 Jun 2017 04:45:09 -0700 (PDT) X-Received: by 10.28.0.13 with SMTP id 13mr1324738wma.19.1496317509867; Thu, 01 Jun 2017 04:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496317509; cv=none; d=google.com; s=arc-20160816; b=wQG6JYtQsYk5dWvTp7QDhe9fGVlujL+mARfLNIGnNp3PZNWSRU8Eka2aKSW+84IKvR 2cM2cd9SXzPM5j9wazp5euTLwC4TtC5TBpjLLIQ5/EKnYwppxnHVa7gnx75JMH1wsEQI LDP8Om+IfneuKLXoOGUStQzYKziRkrmDHkYk9ag0kpLcfe49fR/LLUimXdIl9pvLcJvD dnqC2z/4GAS+bpTHMkf/FpsRo8W3/7/NvahvHMic7CbJP7fyAOshVmb9Qn7mOH6cZzm+ zxJ0Ti/pUu9kGFnluDIxzUNgSn5wAxi9ZRUfUheEusWjszhHqAx4U98WAdAIRkmQuhUi 5QWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=m8Ru53eIZNa7MQtQm7ien7QIcpSzXA0aToXTXC4eqEg=; b=IdG0NFUG0R0UUHvfw/hRnTzL6dXsj/SbR2SkRVRL88ogbmQxh7zcjKI03oriM4XSkf UYULQ0vqoHjEui7hWwhZbZi1bLIREejGSz8qWHImo8a+74HB++O+hssNkponFh4xmnJy X042Hbnk/t4jp0Jk5I3PhHdOA+JNEl4nxmARmkGbLUDcy7LevTmLYDkrpvEoJ52QLpIU fEVrhm25G3udFszAhcHL2L1lNdyO7NUhoe7lukjC2ry6WiVRMQT89I0aDgiR82nGXqXw i2vv+PL4Jnv5m+eQqcvUo7FrAIpKl+awlaDVlhd7SMqx2hlSey5833vs1DguxeosZhGq rPYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e29si17220763wre.37.2017.06.01.04.45.09; Thu, 01 Jun 2017 04:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A52426899EC; Thu, 1 Jun 2017 14:44:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-2.mx.upcmail.net (vie01a-qmta-pe01-2.mx.upcmail.net [62.179.121.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3A3886899E0 for ; Thu, 1 Jun 2017 14:44:52 +0300 (EEST) Received: from [172.31.218.43] (helo=vie01a-dmta-pe05-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dGOXB-0004vp-4p for ffmpeg-devel@ffmpeg.org; Thu, 01 Jun 2017 13:44:57 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dGOX5-00021b-Hz for ffmpeg-devel@ffmpeg.org; Thu, 01 Jun 2017 13:44:51 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id TPko1v00y0S5wYM01PkpWv; Thu, 01 Jun 2017 13:44:49 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 1 Jun 2017 13:44:45 +0200 Message-Id: <20170601114446.11358-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170601114446.11358-1-michael@niedermayer.cc> References: <20170601114446.11358-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/3] avutil/avstring: Fix av_match_name() with seperators in the name itself X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavutil/avstring.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavutil/avstring.c b/libavutil/avstring.c index f03dd25141..c1348b3a13 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -342,22 +342,28 @@ int av_escape(char **dst, const char *src, const char *special_chars, int av_match_name(const char *name, const char *names) { - const char *p; - int len, namelen; + const char *p, *namep; + int len; if (!name || !names) return 0; - namelen = strlen(name); while (*names) { int negate = '-' == *names; p = strchr(names, ','); if (!p) p = names + strlen(names); names += negate; - len = FFMAX(p - names, namelen); - if (!av_strncasecmp(name, names, len) || !strncmp("ALL", names, FFMAX(3, p - names))) - return !negate; + for (namep = name; namep && *namep; ) { + const char *next_namep = strchr(namep, ','); + int namelen = next_namep ? next_namep - namep : strlen(namep); + + len = FFMAX(p - names, namelen); + if (!av_strncasecmp(namep, names, len) || !strncmp("ALL", names, FFMAX(3, p - names))) + return !negate; + namep = next_namep; + namep += !!namep; + } names = p + (*p == ','); } return 0;