mkvparser: check Cluster::Create() return

BUG=23430793

Change-Id: Ie932dd2ee82d41368616999ab75ba3b213008642
This commit is contained in:
James Zern
2015-08-22 10:44:48 -07:00
parent f9885b5882
commit e86d046c07

View File

@@ -1216,8 +1216,8 @@ long Segment::DoLoadCluster(long long& pos, long& len) {
// status > 0 means we have an entry // status > 0 means we have an entry
Cluster* const pCluster = Cluster::Create(this, idx, cluster_off); Cluster* const pCluster = Cluster::Create(this, idx, cluster_off);
// element_size); if (pCluster == NULL)
assert(pCluster); return -1;
AppendCluster(pCluster); AppendCluster(pCluster);
assert(m_clusters); assert(m_clusters);
@@ -2112,7 +2112,8 @@ const BlockEntry* Segment::GetBlock(const CuePoint& cp,
// assert(Cluster::HasBlockEntries(this, tp.m_pos)); // assert(Cluster::HasBlockEntries(this, tp.m_pos));
Cluster* const pCluster = Cluster::Create(this, -1, tp.m_pos); //, -1); Cluster* const pCluster = Cluster::Create(this, -1, tp.m_pos); //, -1);
assert(pCluster); if (pCluster == NULL)
return NULL;
const ptrdiff_t idx = i - m_clusters; const ptrdiff_t idx = i - m_clusters;
@@ -2167,8 +2168,8 @@ const Cluster* Segment::FindOrPreloadCluster(long long requested_pos) {
// assert(Cluster::HasBlockEntries(this, tp.m_pos)); // assert(Cluster::HasBlockEntries(this, tp.m_pos));
Cluster* const pCluster = Cluster::Create(this, -1, requested_pos); Cluster* const pCluster = Cluster::Create(this, -1, requested_pos);
//-1); if (pCluster == NULL)
assert(pCluster); return NULL;
const ptrdiff_t idx = i - m_clusters; const ptrdiff_t idx = i - m_clusters;
@@ -2598,7 +2599,8 @@ const Cluster* Segment::GetNext(const Cluster* pCurr) {
assert(i == j); assert(i == j);
Cluster* const pNext = Cluster::Create(this, -1, off_next); Cluster* const pNext = Cluster::Create(this, -1, off_next);
assert(pNext); if (pNext == NULL)
return NULL;
const ptrdiff_t idx_next = i - m_clusters; // insertion position const ptrdiff_t idx_next = i - m_clusters; // insertion position
@@ -2955,8 +2957,8 @@ long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
Cluster* const pNext = Cluster::Create(this, Cluster* const pNext = Cluster::Create(this,
-1, // preloaded -1, // preloaded
off_next); off_next);
// element_size); if (pNext == NULL)
assert(pNext); return -1;
const ptrdiff_t idx_next = i - m_clusters; // insertion position const ptrdiff_t idx_next = i - m_clusters; // insertion position
@@ -6399,8 +6401,6 @@ Cluster* Cluster::Create(Segment* pSegment, long idx, long long off)
const long long element_start = pSegment->m_start + off; const long long element_start = pSegment->m_start + off;
Cluster* const pCluster = new Cluster(pSegment, idx, element_start); Cluster* const pCluster = new Cluster(pSegment, idx, element_start);
// element_size);
assert(pCluster);
return pCluster; return pCluster;
} }