[vlc-commits] contrib:ebml: fix the loop exit when bogus data are found

Steve Lhomme git at videolan.org
Wed Jan 24 08:46:33 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jan 22 15:45:36 2018 +0100| [1c2004ea6ec8a0be138cc886a77295cc3e49e667] | committer: Jean-Baptiste Kempf

contrib:ebml: fix the loop exit when bogus data are found

(cherry picked from commit b648c4693df7bae6eb64243a5d4cc754be0d6ca4)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1c2004ea6ec8a0be138cc886a77295cc3e49e667
---

 contrib/src/ebml/max-size-loop.patch | 28 ++++++++++++++++++++++++++++
 contrib/src/ebml/rules.mak           |  1 +
 2 files changed, 29 insertions(+)

diff --git a/contrib/src/ebml/max-size-loop.patch b/contrib/src/ebml/max-size-loop.patch
new file mode 100644
index 0000000000..d3da47a5eb
--- /dev/null
+++ b/contrib/src/ebml/max-size-loop.patch
@@ -0,0 +1,28 @@
+From b66ca475be967547af9a3784e720fbbacd381be6 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <slhomme at matroska.org>
+Date: Mon, 22 Jan 2018 15:42:53 +0100
+Subject: [PATCH] Exit the max size loop when there's nothing left possible to
+ find
+
+DataStream.getFilePointer() is not correct in this context. It might force to
+exit too early.
+---
+ src/EbmlElement.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/EbmlElement.cpp b/src/EbmlElement.cpp
+index ac0be41..061074b 100644
+--- a/src/EbmlElement.cpp
++++ b/src/EbmlElement.cpp
+@@ -478,7 +478,7 @@ EbmlElement * EbmlElement::FindNextElement(IOCallback & DataStream, const EbmlSe
+     ReadIndex = SizeIdx - 1;
+     memmove(&PossibleIdNSize[0], &PossibleIdNSize[1], ReadIndex);
+     UpperLevel = UpperLevel_original;
+-  } while ( MaxDataSize > DataStream.getFilePointer() - SizeIdx + PossibleID_Length );
++  } while ( MaxDataSize >= ReadSize );
+ 
+   return NULL;
+ }
+-- 
+2.10.1.windows.1
+
diff --git a/contrib/src/ebml/rules.mak b/contrib/src/ebml/rules.mak
index b635378767..039c9283c8 100644
--- a/contrib/src/ebml/rules.mak
+++ b/contrib/src/ebml/rules.mak
@@ -16,6 +16,7 @@ ebml: libebml-$(EBML_VERSION).tar.xz .sum-ebml
 	$(UNPACK)
 	$(APPLY) $(SRC)/ebml/ebml-maxread.patch
 	$(APPLY) $(SRC)/ebml/unknown-check.patch
+	$(APPLY) $(SRC)/ebml/max-size-loop.patch
 	$(MOVE)
 
 # libebml requires exceptions



More information about the vlc-commits mailing list