From 642c3c4e27609ce99946eaede49d234cad36a3e5 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 21 Aug 2015 15:42:12 +0200 Subject: [PATCH] detect EOF when reading the element size, similar to when reading the element id --- src/EbmlElement.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/EbmlElement.cpp b/src/EbmlElement.cpp index a091d93..39eb6f0 100644 --- a/src/EbmlElement.cpp +++ b/src/EbmlElement.cpp @@ -417,7 +417,10 @@ EbmlElement * EbmlElement::FindNextElement(IOCallback & DataStream, const EbmlSe bFound = false; break; } - ReadSize += DataStream.read(&PossibleIdNSize[SizeIdx++], 1); + if( DataStream.read( &PossibleIdNSize[SizeIdx++], 1 ) == 0 ) { + return NULL; // no more data ? + } + ReadSize++; PossibleSizeLength++; }