[vlc-commits] contrib:ffmpeg: don't use EBML elements in Matroska that are bigger than their parents
Steve Lhomme
git at videolan.org
Thu May 23 17:20:54 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 11 16:06:50 2019 +0100| [8cf800fdcf92af25838ab71d2bb7f819f5d19149] | committer: Hugo Beauzée-Luyssen
contrib:ffmpeg: don't use EBML elements in Matroska that are bigger than their parents
https://hackerone.com/reports/492882
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8cf800fdcf92af25838ab71d2bb7f819f5d19149
---
contrib/src/ffmpeg/ffmpeg-mkv-overshoot.patch | 21 +++++++++++++++++++++
contrib/src/ffmpeg/rules.mak | 1 +
2 files changed, 22 insertions(+)
diff --git a/contrib/src/ffmpeg/ffmpeg-mkv-overshoot.patch b/contrib/src/ffmpeg/ffmpeg-mkv-overshoot.patch
new file mode 100644
index 0000000000..2ad31ca54a
--- /dev/null
+++ b/contrib/src/ffmpeg/ffmpeg-mkv-overshoot.patch
@@ -0,0 +1,21 @@
+--- ffmpeg/libavformat/matroskadec.c.overshoot 2019-02-11 16:03:57.375444600 +0100
++++ ffmpeg/libavformat/matroskadec.c 2019-02-11 16:04:04.418307200 +0100
+@@ -1197,6 +1197,18 @@ static int ebml_parse_elem(MatroskaDemux
+ length, max_lengths[syntax->type], syntax->type);
+ return AVERROR_INVALIDDATA;
+ }
++ if (matroska->num_levels > 0) {
++ MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
++ AVIOContext *pb = matroska->ctx->pb;
++ int64_t pos = avio_tell(pb);
++ if (level->length != (uint64_t) -1 &&
++ (pos + length) > (level->start + level->length)) {
++ av_log(matroska->ctx, AV_LOG_ERROR,
++ "Invalid length 0x%"PRIx64" > 0x%"PRIx64" in parent\n",
++ length, level->start + level->length);
++ return AVERROR_INVALIDDATA;
++ }
++ }
+ }
+
+ switch (syntax->type) {
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 2eeee961a5..2824c526d4 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -244,6 +244,7 @@ ifdef USE_FFMPEG
$(APPLY) $(SRC)/ffmpeg/armv7_fixup.patch
$(APPLY) $(SRC)/ffmpeg/dxva_vc1_crash.patch
$(APPLY) $(SRC)/ffmpeg/h264_early_SAR.patch
+ $(APPLY) $(SRC)/ffmpeg/ffmpeg-mkv-overshoot.patch
endif
ifdef USE_LIBAV
$(APPLY) $(SRC)/ffmpeg/libav_gsm.patch
More information about the vlc-commits
mailing list