This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 23aea1374579d261a70f42a6eec6effb5ea6d6df Author: Zhao Zhili <[email protected]> AuthorDate: Mon Sep 14 20:50:57 2026 +0800 Commit: Zhao Zhili <[email protected]> CommitDate: Thu Sep 17 02:47:35 2026 +0000 avcodec/videotoolboxenc: fix use-after-free of strings av_map_videotoolbox_color_*_from_av() returns borrowed references: CoreVideo constants, or strings owned by CoreVideo's per-process codepoint cache. vtenc_reset() released the stored strings, which for codepoints without a constant name dropped the last reference and freed the cached instance. CoreVideo kept handing the pointer out, so the next encoder open or VT session restart in the same process passed a dangling string to VTSessionSetProperty() and crashed. Crash can be reproduced with: ffmpeg -f lavfi -i testsrc2=d=2,setparams=color_trc=vlog \ -c:v h264_videotoolbox -y a.mp4 \ -c:v h264_videotoolbox -y b.mp4 --- libavcodec/videotoolboxenc.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 536565a252..5fdd7561b0 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -395,20 +395,14 @@ static void vtenc_reset(VTEncContext *vtctx) vtctx->supported_props = NULL; } - if (vtctx->color_primaries) { - CFRelease(vtctx->color_primaries); - vtctx->color_primaries = NULL; - } - - if (vtctx->transfer_function) { - CFRelease(vtctx->transfer_function); - vtctx->transfer_function = NULL; - } - - if (vtctx->ycbcr_matrix) { - CFRelease(vtctx->ycbcr_matrix); - vtctx->ycbcr_matrix = NULL; - } + /* The colorimetry fields hold references borrowed from CoreVideo (Get + * semantics). Releasing them would free CoreVideo's cached string for + * codepoints without a constant name, and later lookups of the same + * codepoint would hand out a dangling pointer. + */ + vtctx->color_primaries = NULL; + vtctx->transfer_function = NULL; + vtctx->ycbcr_matrix = NULL; } static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, ExtraSEI *sei) -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
