Index: media/formats/mp4/box_reader.h |
diff --git a/media/formats/mp4/box_reader.h b/media/formats/mp4/box_reader.h |
index 6b59361612459d84e29448c3b19b43595ab98cce..d70aead5a5e3320a36d9263f5173bedc468bc665 100644 |
--- a/media/formats/mp4/box_reader.h |
+++ b/media/formats/mp4/box_reader.h |
@@ -101,6 +101,9 @@ class MEDIA_EXPORT BoxReader : public BufferReader { |
int* box_size, |
bool* err) WARN_UNUSED_RESULT; |
+ static BoxReader* ReadConcatentatedBoxes(const uint8* buf, |
+ const int buf_size); |
+ |
// Returns true if |type| is recognized to be a top-level box, false |
// otherwise. This returns true for some boxes which we do not parse. |
// Helpful in debugging misaligned appends. |
@@ -148,7 +151,10 @@ class MEDIA_EXPORT BoxReader : public BufferReader { |
const LogCB& log_cb() const { return log_cb_; } |
private: |
- BoxReader(const uint8* buf, const int size, const LogCB& log_cb); |
+ BoxReader(const uint8* buf, |
+ const int size, |
+ const LogCB& log_cb, |
+ bool enforce_size_check); |
// Must be called immediately after init. If the return is false, this |
// indicates that the box header and its contents were not available in the |
@@ -170,6 +176,10 @@ class MEDIA_EXPORT BoxReader : public BufferReader { |
// valid if scanned_ is true. |
ChildMap children_; |
bool scanned_; |
+ |
+ // Set to true if the buffer provided to the reader must contain all the bytes |
+ // as specified by the box header. |
+ bool enforce_size_check_; |
}; |
// Template definitions |
@@ -207,8 +217,9 @@ bool BoxReader::ReadAllChildren(std::vector<T>* children) { |
scanned_ = true; |
bool err = false; |
- while (pos() < size()) { |
- BoxReader child_reader(&buf_[pos_], size_ - pos_, log_cb_); |
+ while (pos_ < size_) { |
+ BoxReader child_reader(&buf_[pos_], size_ - pos_, log_cb_, |
+ enforce_size_check_); |
if (!child_reader.ReadHeader(&err)) break; |
T child; |
RCHECK(child.Parse(&child_reader)); |