mkvparser/Segment: convert asserts to failure returns
Change-Id: I7ccfd5be5e7438561edacb06bc8e6256aa6e0369
This commit is contained in:
parent
fa2aa7da2d
commit
8de3654fdb
@ -1194,7 +1194,8 @@ long Segment::DoLoadCluster(long long& pos, long& len) {
|
|||||||
--m_clusterPreloadCount;
|
--m_clusterPreloadCount;
|
||||||
|
|
||||||
m_pos = pos; // consume payload
|
m_pos = pos; // consume payload
|
||||||
assert((segment_stop < 0) || (m_pos <= segment_stop));
|
if (segment_stop >= 0 && m_pos > segment_stop)
|
||||||
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
return 0; // success
|
return 0; // success
|
||||||
}
|
}
|
||||||
@ -2729,7 +2730,8 @@ long Segment::ParseNext(const Cluster* pCurr, const Cluster*& pResult,
|
|||||||
// Pos now points to start of payload
|
// Pos now points to start of payload
|
||||||
|
|
||||||
pos += size; // consume payload (that is, the current cluster)
|
pos += size; // consume payload (that is, the current cluster)
|
||||||
assert((segment_stop < 0) || (pos <= segment_stop));
|
if (segment_stop >= 0 && pos > segment_stop)
|
||||||
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
// By consuming the payload, we are assuming that the curr
|
// By consuming the payload, we are assuming that the curr
|
||||||
// cluster isn't interesting. That is, we don't bother checking
|
// cluster isn't interesting. That is, we don't bother checking
|
||||||
@ -2865,7 +2867,8 @@ long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos += size; // consume payload
|
pos += size; // consume payload
|
||||||
assert((segment_stop < 0) || (pos <= segment_stop));
|
if (segment_stop >= 0 && pos > segment_stop)
|
||||||
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2875,7 +2878,8 @@ long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
|
|||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
pos += size; // consume payload
|
pos += size; // consume payload
|
||||||
assert((segment_stop < 0) || (pos <= segment_stop));
|
if (segment_stop >= 0 && pos > segment_stop)
|
||||||
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3054,7 +3058,8 @@ long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
|
|||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
pos += size; // consume payload of sub-element
|
pos += size; // consume payload of sub-element
|
||||||
assert((segment_stop < 0) || (pos <= segment_stop));
|
if (segment_stop >= 0 && pos > segment_stop)
|
||||||
|
return E_FILE_FORMAT_INVALID;
|
||||||
} // determine cluster size
|
} // determine cluster size
|
||||||
|
|
||||||
cluster_size = pos - payload_pos;
|
cluster_size = pos - payload_pos;
|
||||||
@ -3064,7 +3069,8 @@ long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos += cluster_size; // consume payload
|
pos += cluster_size; // consume payload
|
||||||
assert((segment_stop < 0) || (pos <= segment_stop));
|
if (segment_stop >= 0 && pos > segment_stop)
|
||||||
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
return 2; // try to find a cluster that follows next
|
return 2; // try to find a cluster that follows next
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user