Block::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop) with error checks BUG=23431751 Change-Id: Ia1265a639086c790a2ed542f34c2f438c153b036
This commit is contained in:
parent
b366a98053
commit
06b4337ed8
@ -7362,7 +7362,6 @@ long Block::Parse(const Cluster* pCluster) {
|
|||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
++pos; // consume frame count
|
++pos; // consume frame count
|
||||||
assert(pos <= stop);
|
|
||||||
if (pos > stop)
|
if (pos > stop)
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
@ -7420,8 +7419,6 @@ long Block::Parse(const Cluster* pCluster) {
|
|||||||
--frame_count;
|
--frame_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pf < pf_end);
|
|
||||||
assert(pos <= stop);
|
|
||||||
if (pf >= pf_end || pos > stop)
|
if (pf >= pf_end || pos > stop)
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
@ -7566,7 +7563,6 @@ long Block::Parse(const Cluster* pCluster) {
|
|||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
pos += len; // consume length of (delta) size
|
pos += len; // consume length of (delta) size
|
||||||
assert(pos <= stop);
|
|
||||||
if (pos > stop)
|
if (pos > stop)
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
@ -7590,20 +7586,18 @@ long Block::Parse(const Cluster* pCluster) {
|
|||||||
|
|
||||||
// parse last frame
|
// parse last frame
|
||||||
if (frame_count > 0) {
|
if (frame_count > 0) {
|
||||||
assert(pos <= stop);
|
if (pos > stop || pf >= pf_end)
|
||||||
assert(pf < pf_end);
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
const Frame& prev = *pf++;
|
const Frame& prev = *pf++;
|
||||||
assert(prev.len == frame_size);
|
assert(prev.len == frame_size);
|
||||||
if (prev.len != frame_size)
|
if (prev.len != frame_size)
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
assert(pf < pf_end);
|
|
||||||
if (pf >= pf_end)
|
if (pf >= pf_end)
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
Frame& curr = *pf++;
|
Frame& curr = *pf++;
|
||||||
assert(pf == pf_end);
|
|
||||||
if (pf != pf_end)
|
if (pf != pf_end)
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user