From 2c835bcc289ba5a312ede5b357e56a1b972351f1 Mon Sep 17 00:00:00 2001 From: matthewjheaney Date: Thu, 10 Feb 2011 13:32:40 -0500 Subject: [PATCH] libwebm: handle (as error) cluster with unknown size Change-Id: I8342d50d0482d77cb895ae659568016eb48ed2be --- mkvparser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mkvparser.cpp b/mkvparser.cpp index faffbf1..f7e0b0b 100644 --- a/mkvparser.cpp +++ b/mkvparser.cpp @@ -1511,6 +1511,11 @@ long Segment::LoadCluster( if (size < 0) //error return static_cast(size); + const long long unknown_size = (1LL << (7 * len)) - 1; + + if (size == unknown_size) + return E_FILE_FORMAT_INVALID; //TODO: allow this + pos += len; //consume length of size of element const long long element_size = size + pos - idpos; @@ -3361,7 +3366,10 @@ long Segment::ParseNext( return result; if (result > 0) //no more clusters + { + //pResult = &m_eos; return 1; + } pResult = GetLast(); return 0; //success @@ -3607,7 +3615,10 @@ long Segment::ParseNext( } if (off_next <= 0) //no next cluster found + { + //pResult = &m_eos; return 1; + } //We have parsed the next cluster, and can even guarantee //that its payload is all available (via IMkvReader::Length).