From patchwork Sat Apr 23 20:06:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35380 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1086099pzh; Sat, 23 Apr 2022 13:07:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ab3aEWPc9TZmgAlkAfL33MD1AN9NtDzeCKVznStpC1wrdVrUVeGpLXmdDu7XZu7PEGAx X-Received: by 2002:a05:6402:5ca:b0:423:f330:f574 with SMTP id n10-20020a05640205ca00b00423f330f574mr11646380edx.116.1650744448113; Sat, 23 Apr 2022 13:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744448; cv=none; d=google.com; s=arc-20160816; b=qNRejdgU+Nr2fHrffRsOCyQzLKmD+KsandPfL0+mSeK2izlmGxvXIEAwyYERhY2Kvs 8qu/aiJCLdlnBLZb+/AdtPEsZYvN90gPbWQ6i3ROKWsKAUhGTBXdifdKWLiLkuOgs93q lbKn0l+bwjphGvPXJC56Tj93piK6X83dxGkWPD+qjzOCdE4n7xO+ardQrgillLUO69eU RkrY52G+g6BTzUkEoT/6gxg2Ufnp/xzcx3LcNf5B/4vTvIQNOVd3QzgnRypNIG3dUmwY Qa+066k20vcsXHLtSzmrtB5NyTFs0xF8K2CdiIFuRgErTK+4oqtEPF//d+sSlvgkBIG9 AMaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Pl0PLxUStBiZGAoVIeSQETXGuoV8tZb9V3Zrnf4nwP4=; b=NvhWUvwtbCndB8DWJ7IVPugzli9v1OiOvoopqWo8rtd9t9Kb3St6mHeKASitPdgU1e bHkZP8Dtt73b1wLQ/rH2YXPgkSKqJ9P3tl6GpX0DBrSSl06hv+3I+NeV6iY140QQaUyg qWlHJF3HBTm6xU6ZVYCRchM2oeGUrFGgrJhG1qcpayM0F2DLa1NKARk5PxaPcxMzzJZP /hsN/RGCBm5N+IPzUVLZN2xya4cR5TUELbHoJMddUs//aAZqvYZd/Js0Mso4fp6sZu/k XnU0xvRTCwNe85oFIdN3clxPLddWk9C1xufys3yracrem7bHRPqbweFIJqCBrbM8SZ0r ygKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WwOgw9pi; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 8-20020a508e08000000b0041d130a5087si9431354edw.427.2022.04.23.13.07.27; Sat, 23 Apr 2022 13:07:28 -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; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WwOgw9pi; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1053A68B3BB; Sat, 23 Apr 2022 23:07:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 514BD68B2D2 for ; Sat, 23 Apr 2022 23:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744427; bh=c6I6DJoJEcHze4lKJk/RqaRg3MXYs7DyvuFduRUa2Fo=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=WwOgw9piR1mHV4ls19z1y2qF6o25XZLmw8ql6LVAsf2MUyZeuhMgKhEdV8khjCdFe K2ZAu6UaHo7y0QPOgtHZ/XsSIqI3iekRqfgx5rqN56kfXZgfTHTWQARaYjZckF/Z2t lOfxx9SV1EcLsgeq5hi7npNSSXXqEafPO+1f4Hig= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:07:02 +0200 (CEST) X-EA-Auth: 9GM9cafbZa9hegcRxr9lWXeVzCFbCfNIk4RLwbMHaqwMbFDaUUvaXEIsZXCi4bNVYb0UqrRi3phKPTGN0LBSO5jfoSbap2Q+ePbdPLOhKfY= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:06:47 +0300 Message-Id: <20220423200651.36689-1-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423200335.36487-1-nil-admirari@mailo.com> References: <20220423200335.36487-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 2/6] libavformat/avisynth.c: Remove MAX_PATH limit X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: xKijl9tys613 --- libavformat/avisynth.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 8ba2bdea..f7bea8c3 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -34,6 +34,7 @@ /* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" + #include "libavutil/wchar_filename.h" #undef EXTERN_C #define AVISYNTH_LIB "avisynth" #else @@ -810,8 +811,7 @@ static int avisynth_open_file(AVFormatContext *s) AVS_Value arg, val; int ret; #ifdef _WIN32 - char filename_ansi[MAX_PATH * 4]; - wchar_t filename_wc[MAX_PATH * 4]; + char *filename_ansi = NULL; #endif if (ret = avisynth_context_create(s)) @@ -819,10 +819,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ - MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); - WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, - MAX_PATH * 4, NULL, NULL); + if (utf8toansi(s->url, &filename_ansi)) { + ret = AVERROR_UNKNOWN; + goto fail; + } arg = avs_new_value_string(filename_ansi); + av_free(filename_ansi); #else arg = avs_new_value_string(s->url); #endif