History

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.

Andreas Rheinhardt committed 1 year ago

Commit 92e310e1 parent bf6d3dc2 files · +6 −1Browse files

Unified · Split

2 files
  1. libavformat/matroskadec.c +5 −0
  2. tests/ref/fate/matroska-mastering-display-metadata +1 −1
libavformat/matroskadec.c+5−0
@@ -2877,6 +2877,11 @@ static int mkv_parse_video_codec(MatroskaTrack *track, AVCodecParameters *par, · 2876 unmodified lines
28772877 {
28782878 if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
28792879 track->codec_priv.size >= 40) {
2880+ uint32_t size = AV_RL32A(track->codec_priv.data);
2881+ // VFW extradata is padded to an even length, yet
2882+ // the size field contains the real length.
2883+ if (size & 1 && size == track->codec_priv.size - 1)
2884+ --track->codec_priv.size;
28802885 track->ms_compat = 1;
28812886 par->bits_per_coded_sample = AV_RL16(track->codec_priv.data + 14);
28822887 par->codec_tag = AV_RL32(track->codec_priv.data + 16);
tests/ref/fate/matroska-mastering-display-metadata+1−1
@@ -1,7 +1,7 @@
11 c1e5e2ecf433cf05af8556debc7d4d0b *tests/data/fate/matroska-mastering-display-metadata.matroska
22 1669773 tests/data/fate/matroska-mastering-display-metadata.matroska
33 #extradata 0: 4, 0x040901a3
4−#extradata 3: 202, 0xfce96279
4+#extradata 3: 201, 0x9a706279
55 #tb 0: 1/1000
66 #media_type 0: video
77 #codec_id 0: prores

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t