summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg/A19-matroskaenc-aac-extradata-updated.patch
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/A19-matroskaenc-aac-extradata-updated.patch')
-rw-r--r--contrib/ffmpeg/A19-matroskaenc-aac-extradata-updated.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A19-matroskaenc-aac-extradata-updated.patch b/contrib/ffmpeg/A19-matroskaenc-aac-extradata-updated.patch
new file mode 100644
index 000000000..8916a79ea
--- /dev/null
+++ b/contrib/ffmpeg/A19-matroskaenc-aac-extradata-updated.patch
@@ -0,0 +1,24 @@
+Updated version of patch by John Stebbins <[email protected]>
+[PATCH] avformat/matroskaenc: return error if aac extradata changes
+extradata changing would result in an invalid stream.
+also, as the code was written, rewriting extradata was corrupting the
+track header resulting in an invalid file.
+--- ffmpeg/libavformat/matroskaenc.c.orig 2020-06-18 01:03:40.000000000 -0400
++++ ffmpeg/libavformat/matroskaenc.c 2020-06-18 01:30:46.000000000 -0400
+@@ -2193,6 +2193,16 @@
+ case AV_CODEC_ID_AAC:
+ if (side_data_size && mkv->track.bc) {
+ int filler, output_sample_rate = 0;
++ if (par->extradata && par->extradata_size) {
++ if (par->extradata_size != side_data_size ||
++ memcmp(par->extradata, side_data, side_data_size)) {
++ av_log(s, AV_LOG_ERROR, "Error, AAC extradata changed mid-stream.\n");
++ return AVERROR(EINVAL);
++ } else {
++ // Already written
++ break;
++ }
++ }
+ ret = get_aac_sample_rates(s, mkv, side_data, side_data_size,
+ &track->sample_rate, &output_sample_rate);
+ if (ret < 0)