From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1AC8540059 for ; Sat, 19 Feb 2022 09:57:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7F10D68B18A; Sat, 19 Feb 2022 11:56:53 +0200 (EET) Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32B7068B0CD for ; Sat, 19 Feb 2022 11:56:43 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1645264596; bh=v0NXlsvOi2QMYMh51jQD1B6JipWxNNrVG0rV2ZtjWAQ=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=DJOcmMXh1eFHhlVG3AOrYe9kuG5eIE23/AauSoXP32uPbAApJ66L775yds5TdVCxz Sryc/Ic+6gDVxGB0NyYiOFu8ZXXQMaLtVKlRbhfFoD2mL1YLPLOlPoE3yGhwbgg0qw wiwnMUeKMMNkS65xJgXEHi1ZtgBob/zGezd5MMG4= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 19 Feb 2022 10:56:36 +0100 (CET) X-EA-Auth: OtCLGuJF4c+Vq+Ldx7mWEhJQq5V+oVqDfxeJ8cUz2gEvlFuO7KlCE3CWkyweQbba0iYk1USsb+wHFnRz4hznqiHqqmd0mhR9608osOMUzbI= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 19 Feb 2022 12:56:19 +0300 Message-Id: <20220219095623.9417-2-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219095623.9417-1-nil-admirari@mailo.com> References: <20220219095623.9417-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 2/6] libavformat/avisynth.c: Replace MAX_PATH-sized buffers with dynamically sized ones 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- libavformat/avisynth.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2bd0c69..e28d832 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 @@ -793,8 +794,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)) @@ -802,10 +802,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 -- 2.32.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".