Avoid overflows in Block::GetTimeCode().

BUG=b/66854237

Change-Id: I721bfa0579597995ae0b488f69bcf17aba6c32c6
diff --git a/mkvparser/mkvparser.cc b/mkvparser/mkvparser.cc
index 1eeaa13..d8b2343 100644
--- a/mkvparser/mkvparser.cc
+++ b/mkvparser/mkvparser.cc
@@ -7976,6 +7976,11 @@
   const long long tc0 = pCluster->GetTimeCode();
   assert(tc0 >= 0);
 
+  // Check if tc0 + m_timecode would overflow.
+  if (tc0 < 0 || LLONG_MAX - tc0 < m_timecode) {
+    return -1;
+  }
+
   const long long tc = tc0 + m_timecode;
 
   return tc;  // unscaled timecode units