Fix packager crash with corrupted media file
The corrupted media file contains an invalid chunk offset box. Bug: 18411271 Change-Id: I3d7f51c3647134bd7d0846d0992e10e398784475
This commit is contained in:
parent
a1ce657a06
commit
f66ebe82bb
|
@ -39,7 +39,6 @@ void OffsetByteQueue::Pop(int count) {
|
|||
}
|
||||
|
||||
void OffsetByteQueue::PeekAt(int64_t offset, const uint8_t** buf, int* size) {
|
||||
DCHECK_GE(offset, head());
|
||||
if (offset < head() || offset >= tail()) {
|
||||
*buf = NULL;
|
||||
*size = 0;
|
||||
|
|
|
@ -399,9 +399,16 @@ bool MP4MediaParser::EnqueueSample(bool* err) {
|
|||
return !*err;
|
||||
}
|
||||
|
||||
queue_.PeekAt(runs_->sample_offset() + moof_head_, &buf, &buf_size);
|
||||
if (buf_size < runs_->sample_size())
|
||||
int64_t sample_offset = runs_->sample_offset() + moof_head_;
|
||||
queue_.PeekAt(sample_offset, &buf, &buf_size);
|
||||
if (buf_size < runs_->sample_size()) {
|
||||
if (sample_offset < queue_.head()) {
|
||||
LOG(ERROR) << "Incorrect sample offset " << sample_offset
|
||||
<< " < " << queue_.head();
|
||||
*err = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
scoped_refptr<MediaSample> stream_sample(MediaSample::CopyFrom(
|
||||
buf, runs_->sample_size(), runs_->is_keyframe()));
|
||||
|
|
Loading…
Reference in New Issue