]> git.sesse.net Git - nageru/commitdiff
Fix a read-past-the-end in av_write_header(); extradata must have AV_INPUT_BUFFER_PAD...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 21 Jul 2022 21:01:26 +0000 (23:01 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 21 Jul 2022 21:01:26 +0000 (23:01 +0200)
shared/mux.cpp

index f6452795f4ab80ff51b6b9e391191c3c6194e90d..0a2eaef6a8310f53b5f7ea0d9a175ea1eb226570 100644 (file)
@@ -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());
        }