[FFmpeg-cvslog] avformat/matroskadec: Fix VfW extradata size
Andreas Rheinhardt
git at videolan.org
Sat Jun 7 11:17:15 EEST 2025
ffmpeg | branch: release/7.1 | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun May 25 05:12:05 2025 +0200| [0755e038ca9cee6094ba7310f4b40a3105735055] | committer: Andreas Rheinhardt
avformat/matroskadec: Fix VfW extradata size
The structure is padded to an even length with an internal
size field to indicate the real size.
The matroska-matroska-display-metadata test (writing FFV1
in VFW mode) was affected by this.
It should also fix ticket #11613.
Reviewed-by: compn <ff at hawaiiantel.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
(cherry picked from commit 92e310eb82e04713e55d248b65c22f0eb95afada)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0755e038ca9cee6094ba7310f4b40a3105735055
---
libavformat/matroskadec.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index efa3e44c85..105a90a937 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2876,6 +2876,11 @@ static int mkv_parse_video_codec(MatroskaTrack *track, AVCodecParameters *par,
{
if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
track->codec_priv.size >= 40) {
+ uint32_t size = AV_RL32A(track->codec_priv.data);
+ // VFW extradata is padded to an even length, yet
+ // the size field contains the real length.
+ if (size & 1 && size == track->codec_priv.size - 1)
+ --track->codec_priv.size;
track->ms_compat = 1;
par->bits_per_coded_sample = AV_RL16(track->codec_priv.data + 14);
par->codec_tag = AV_RL32(track->codec_priv.data + 16);
More information about the ffmpeg-cvslog
mailing list