From: michaelni via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: michaelni <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] avformat/hlsenc: fix format string vulnerability in parse_playlist (alternative fix) (PR #21599)
Date: Tue, 27 Jan 2026 16:40:55 -0000
Message-ID: <176953205562.25.11167763570974476295@4457048688e7> (raw)
PR #21599 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21599
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21599.patch
Found-by: Sarthak Munshi <sarthakmunshi@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>From 1739a50cdba18bbb4e1b6ea19fbf37f2b5e1f114 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael@niedermayer.cc>
Date: Tue, 27 Jan 2026 16:57:30 +0100
Subject: [PATCH] avformat/hlsenc: fix format string vulnerability in
parse_playlist (alternative fix)
Found-by: Sarthak Munshi <sarthakmunshi@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavformat/hlsenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7105404d1e..ee64a5a275 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1242,13 +1242,13 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
if (vs->has_subtitle) {
int vtt_index = extract_segment_number(line);
const char *vtt_basename = av_basename(vs->vtt_basename);
- int len = strlen(vtt_basename) + 11;
- char *vtt_file = av_mallocz(len);
- if (!vtt_file) {
+ char *vtt_file = NULL;
+ int ret = replace_int_data_in_filename(&vtt_file, vtt_basename, 'd', vtt_index);
+ if (ret < 0 || !vtt_file) {
ret = AVERROR(ENOMEM);
goto fail;
}
- snprintf(vtt_file, len, vtt_basename, vtt_index);
+
ff_format_set_url(vs->vtt_avf, vtt_file);
}
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2026-01-27 16:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176953205562.25.11167763570974476295@4457048688e7 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git