From patchwork Sat Apr 23 20:56:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35385 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101090pzh; Sat, 23 Apr 2022 13:56:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmY59UBrFE0bDHm8q0eiWGiJLXRTmJ2hrnSFtvmxlXhAxkRHIt63XhxivxKxJU4KY1AhQU X-Received: by 2002:a17:906:d10c:b0:6cd:4aa2:cd62 with SMTP id b12-20020a170906d10c00b006cd4aa2cd62mr9523262ejz.229.1650747414512; Sat, 23 Apr 2022 13:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747414; cv=none; d=google.com; s=arc-20160816; b=oxIvai9D5/b1spqh1+AZxdxw0zlfMA+WYyb0uyaxgW8MOseSSd9VgmZQhIXsD+0WWX P2jjgFK7NLkwjPQ/QpB/xei18S3y++Bb75s9uiCklL4CUr0/J15nkAS8zyWN6QD6SHil c4P76heVKrvHMJIdgA6qjBO6VIgSQwG3dAS2evlzuUcZh3rCtRmWDO7yszNo3wo4zPTr nWuv9M+thZBv4yEJVd/cVUWfyf7gvBWrja6s1Hmyei3g/jR/a6d7oBY38UR+dMvtG2Q1 uGOlf0vXvj0LEdSp+eQKVun+W25yS7fmMGy6nCkt/308JiP+AYpe6pRY21vWU/RwWMHl 6Fig== 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=DWruE+TjIMONV+3+dpiGo6XIBXuVEw9uh2MN7wDFaa/PjvCdwzYNK27Isb5yUsJ4Qz j/Xh7sS+HWNp9x3ilUQWsSiiverNh4yNHz3BLQetm72B9kkFc+VLGy2KGzdLffHzS5Hx tIoUktrI8x14K02oIBufisMxO6yucaap0rAxkxiDZ9q1FE0PdbruFfhUuXEGa43UJc50 p7F7l+2tWjdjJcWWQVVrUPVnDvIiePMZXrau58/Jyz74yhs0ZkY3ABaD59yU8P/TK7Yv +niRq8b7akhf5cl5CdmbLn8CRN3dG61v6M/6jKUqyhAcF33ygFbQkYpCYJGofajF+/Ph NoBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=R7buzAA2; 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 mb11-20020a170906eb0b00b006e7fd413915si10229649ejb.946.2022.04.23.13.56.54; Sat, 23 Apr 2022 13:56:54 -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=R7buzAA2; 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 3D4AB68B393; Sat, 23 Apr 2022 23:56:51 +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 BE33D68B2CC for ; Sat, 23 Apr 2022 23:56:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747397; 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=R7buzAA2gAmhqAUt09KxEK7QezY6/qWVMv97Gctm1hQ0q8wVyxMkd569R8S5WJmji shvbq3D65Xv9vntxb0ZFa/7Uou5TxQ1PcX7wmYkLb2Mf4wQ04HZVnO6CEmKHpgFo3e yGPRNJADtDlpe4En06OR46lIiCu/fTd/dcir3tts= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:56:37 +0200 (CEST) X-EA-Auth: n/pN4b3Q+FF7MmEe0vQPVkouzPMAUYf0CwfVIOVA0x1Pa37djo4R72QKu2PBK6DQkPU58G3J6oEJyueEPv7JR+iDFuKO6qUv/jtq+E7K91c= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:56:22 +0300 Message-Id: <20220423205626.39039-2-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423205626.39039-1-nil-admirari@mailo.com> References: <20220423205626.39039-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 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: pcBvF5WptWjf --- 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