From ee6ece72bc12e5527e114e0e1973f0c0b2dc2138 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 21 Jul 2022 23:01:26 +0200 Subject: [PATCH] Fix a read-past-the-end in av_write_header(); extradata must have AV_INPUT_BUFFER_PADDING_SIZE padding as per avformat.h comments. --- shared/mux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/mux.cpp b/shared/mux.cpp index f645279..0a2eaef 100644 --- a/shared/mux.cpp +++ b/shared/mux.cpp @@ -86,7 +86,7 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const avstream_video->codecpar->field_order = AV_FIELD_PROGRESSIVE; if (!video_extradata.empty()) { - avstream_video->codecpar->extradata = (uint8_t *)av_malloc(video_extradata.size()); + avstream_video->codecpar->extradata = (uint8_t *)av_malloc(video_extradata.size() + AV_INPUT_BUFFER_PADDING_SIZE); avstream_video->codecpar->extradata_size = video_extradata.size(); memcpy(avstream_video->codecpar->extradata, video_extradata.data(), video_extradata.size()); } -- 2.39.2