From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 94A224CC91 for ; Fri, 8 Aug 2025 17:57:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id D748C68CA40; Fri, 8 Aug 2025 20:57:54 +0300 (EEST) Received: from 0f9ae49ae7c8 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 06A5F68019F for ; Fri, 8 Aug 2025 20:57:53 +0300 (EEST) MIME-Version: 1.0 From: Jacob Lifshay To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_smpte436m=5Fto=5Feia608_and?= =?utf-8?q?_eia608=5Fto=5Fsmpte436m=3A_fix_memory_leaks_--_forgot_to_free_?= =?utf-8?q?input_av=5Fpacket_=28PR_=2320182=29?= 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" Message-Id: <20250808175754.D748C68CA40@ffbox0-bg.ffmpeg.org> Date: Fri, 8 Aug 2025 20:57:54 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20182 opened by Jacob Lifshay (programmerjake) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20182 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20182.patch Fix some memory leaks. Also adds a test to actually test smpte436m_to_eia608 which I forgot to add in #20024 reported in https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20024#issuecomment-2405 Reported-by: @sean_mcg >From 6d57c2750d2231ce0576177752fc2b64178e6113 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 8 Aug 2025 10:31:41 -0700 Subject: [PATCH 1/3] lavc/bsf/eia608_to_smpte436m: fix memory leak -- forgot to free input av_packet reported in https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20024#issuecomment-2405 Reported-by: Sean McGovern Signed-off-by: Jacob Lifshay --- libavcodec/bsf/eia608_to_smpte436m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bsf/eia608_to_smpte436m.c b/libavcodec/bsf/eia608_to_smpte436m.c index 769731341f..096acb596c 100644 --- a/libavcodec/bsf/eia608_to_smpte436m.c +++ b/libavcodec/bsf/eia608_to_smpte436m.c @@ -236,7 +236,7 @@ static int ff_eia608_to_smpte436m_filter(AVBSFContext *ctx, AVPacket *out) if (ret < 0) goto fail; - return 0; + ret = 0; fail: if (ret < 0) -- 2.49.1 >From 224f82bd8943818797b62dbd8a1a7f771195bc67 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 8 Aug 2025 10:33:34 -0700 Subject: [PATCH 2/3] lavc/bsf/smpte436m_to_eia608: fix memory leak -- forgot to free input av_packet Signed-off-by: Jacob Lifshay --- libavcodec/bsf/smpte436m_to_eia608.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/bsf/smpte436m_to_eia608.c b/libavcodec/bsf/smpte436m_to_eia608.c index 83a220cd1f..529ae88794 100644 --- a/libavcodec/bsf/smpte436m_to_eia608.c +++ b/libavcodec/bsf/smpte436m_to_eia608.c @@ -68,6 +68,8 @@ static int ff_smpte436m_to_eia608_filter(AVBSFContext *ctx, AVPacket *out) // verified it won't fail by running it above av_smpte_291m_anc_8bit_extract_cta_708(&anc, out->data, ctx); + av_packet_free(&in); + return 0; } if (ret != AVERROR_EOF) -- 2.49.1 >From adfc89ce7b2b2973d12079d90e6c1ec876666cb4 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 8 Aug 2025 10:49:33 -0700 Subject: [PATCH 3/3] tests/fate/subtitles: add test for smpte436m_to_eia608 bsf Signed-off-by: Jacob Lifshay --- tests/fate/subtitles.mak | 4 ++ tests/ref/fate/sub-mcc-remux-eia608-recode | 76 ++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/ref/fate/sub-mcc-remux-eia608-recode diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index 217a63791c..87f686d1c9 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -143,6 +143,10 @@ FATE_SUBTITLES-$(call DEMMUX, MCC, MCC, SMPTE436M_TO_EIA608_BSF EIA608_TO_SMPTE4 fate-sub-mcc-remux-eia608: CMD = fmtstdout mcc -f mcc -i tests/ref/fate/sub-mcc-remux -map 0:s -c copy -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00" fate-sub-mcc-remux-eia608: CMP = rawdiff +FATE_SUBTITLES-$(call DEMMUX, MCC, MCC, SMPTE436M_TO_EIA608_BSF EIA608_TO_SMPTE436M_BSF) += fate-sub-mcc-remux-eia608-recode +fate-sub-mcc-remux-eia608-recode: CMD = fmtstdout mcc -eia608_extract 0 -f mcc -i tests/ref/fate/sub-mcc-remux -map 0:d -c copy -bsf smpte436m_to_eia608 -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00" +fate-sub-mcc-remux-eia608-recode: CMP = rawdiff + FATE_SUBTITLES-$(call DEMMUX, MCC, MCC) += fate-sub-mcc-remux fate-sub-mcc-remux: CMD = fmtstdout mcc -eia608_extract 0 -f mcc -i tests/ref/fate/sub-mcc-remux -map 0:d -c copy -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00" fate-sub-mcc-remux: CMP = rawdiff diff --git a/tests/ref/fate/sub-mcc-remux-eia608-recode b/tests/ref/fate/sub-mcc-remux-eia608-recode new file mode 100644 index 0000000000..01e8c37b2c --- /dev/null +++ b/tests/ref/fate/sub-mcc-remux-eia608-recode @@ -0,0 +1,76 @@ +File Format=MacCaption_MCC V2.0 + +/////////////////////////////////////////////////////////////////////////////////// +// Computer Prompting and Captioning Company +// Ancillary Data Packet Transfer File +// +// Permission to generate this format is granted provided that +// 1. This ANC Transfer file format is used on an as-is basis and no warranty is given, and +// 2. This entire descriptive information text is included in a generated .mcc file. +// +// General file format: +// HH:MM:SS:FF(tab)[Hexadecimal ANC data in groups of 2 characters] +// Hexadecimal data starts with the Ancillary Data Packet DID (Data ID defined in S291M) +// and concludes with the Check Sum following the User Data Words. +// Each time code line must contain at most one complete ancillary data packet. +// To transfer additional ANC Data successive lines may contain identical time code. +// Time Code Rate=[24, 25, 30, 30DF, 50, 60, 60DF] +// +// ANC data bytes may be represented by one ASCII character according to the following schema: +// G FAh 00h 00h +// H 2 x (FAh 00h 00h) +// I 3 x (FAh 00h 00h) +// J 4 x (FAh 00h 00h) +// K 5 x (FAh 00h 00h) +// L 6 x (FAh 00h 00h) +// M 7 x (FAh 00h 00h) +// N 8 x (FAh 00h 00h) +// O 9 x (FAh 00h 00h) +// P FBh 80h 80h +// Q FCh 80h 80h +// R FDh 80h 80h +// S 96h 69h +// T 61h 01h +// U E1h 00h 00h 00h +// Z 00h +// +/////////////////////////////////////////////////////////////////////////////////// + +UUID=0087C4F6-A6B4-5469-8C8E-BBF44950401D +Creation Program=FFmpeg +Creation Date=Thursday, January 1, 1970 +Creation Time=00:00:00 +Time Code Rate=30DF + +00:00:58:29 T49S494F43ZZ72F4QROO74ZZBFAB +00:00:59:00 T49S494F43Z0172F4QROO74Z01BDAB +00:00:59:01 T49S494F43Z0272F4QROO74Z02BBAB +00:00:59:02 T49S494F43Z0372F4QROO74Z03B9AB +00:00:59:03 T49S494F43Z0472F4QROO74Z04B7AB +00:00:59:04 T49S494F43Z0572F4QROO74Z05B5AB +00:00:59:05 T49S494F43Z0672F4QROO74Z06B3AB +00:00:59:06 T49S494F43Z0772F4QROO74Z07B1AB +00:00:59:07 T49S494F43Z0872F4QROO74Z08AFAB +00:00:59:08 T49S494F43Z0972F4QROO74Z09ADAB +00:00:59:09 T49S494F43Z0A72F4QROO74Z0AABAB +00:00:59:10 T49S494F43Z0B72F4QROO74Z0BA9AB +00:00:59:11 T49S494F43Z0C72F4QROO74Z0CA7AB +00:00:59:12 T49S494F43Z0D72F4QROO74Z0DA5AB +00:00:59:13 T49S494F43Z0E72F4QROO74Z0EA3AB +00:00:59:14 T49S494F43Z0F72F4QROO74Z0FA1AB +00:00:59:15 T49S494F43Z1072F4QROO74Z109FAB +00:00:59:16 T49S494F43Z1172F4QROO74Z119DAB +00:00:59:17 T49S494F43Z1272F4QROO74Z129BAB +00:00:59:18 T49S494F43Z1372F4QROO74Z1399AB +00:00:59:19 T49S494F43Z1472F4QROO74Z1497AB +00:00:59:20 T49S494F43Z1572F4QROO74Z1595AB +00:00:59:21 T49S494F43Z1672F4QROO74Z1693AB +00:00:59:22 T49S494F43Z1772F4QROO74Z1791AB +00:00:59:23 T49S494F43Z1872F4QROO74Z188FAB +00:00:59:24 T49S494F43Z1972F4QROO74Z198DAB +00:00:59:25 T49S494F43Z1A72F4QROO74Z1A8BAB +00:00:59:26 T49S494F43Z1B72F4QROO74Z1B89AB +00:00:59:27 T49S494F43Z1C72F4QROO74Z1C87AB +00:00:59:28 T49S494F43Z1D72F4QROO74Z1D85AB +00:00:59:29 T49S494F43Z1E72F4QROO74Z1E83AB +00:01:00:02 T49S494F43Z1F72F4QROO74Z1F81AB -- 2.49.1 _______________________________________________ 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".