From: Steve Lhomme <slhomme@matroska.org>
Date: Mon, 22 Jan 2018 15:42:53 +0100
Subject: 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 26510c7..1e35f29 100644
--- a/src/EbmlElement.cpp
+++ b/src/EbmlElement.cpp
@@ -468,7 +468,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;
 }
