Code: bool Chapters::Edition::ExpandAtomsArray()
{
    if (m_atoms_size > m_atoms_count)
        return true;  // nothing else to do
 
    const int size = (m_atoms_size == 0) ? 1 : 2 * m_atoms_size;
 
    Atom* const atoms = new (std::nothrow) Atom[size];
 
    if (atoms == NULL)
        return false;
 
    for (int idx = 0; idx < m_atoms_count; ++idx)
    {
        m_atoms[idx].ShallowCopy(atoms[idx]);
     }
 
    delete[] m_atoms;
    m_atoms = atoms;
 
    m_atoms_size = size;
    return true;
 }

Commit Message: libwebm: Pull from upstream

Rolling mkvparser from upstream. Primarily for fixing a bug on parsing
failures with certain Opus WebM files.

Upstream commit hash of this pull: 574045edd4ecbeb802ee3f1d214b5510269852ae

The diff is so huge because there were some style clean ups upstream.
But it was ensured that there were no breaking changes when the style
clean ups was done upstream.

Change-Id: Ib6e907175484b4b0ae1b55ab39522ea3188ad039
CWE ID: CWE-119
bool Chapters::Edition::ExpandAtomsArray()
  IMkvReader* const pReader = m_pSegment->m_pReader;
 
  long long pos = m_start;
  const long long stop = m_start + m_size;
 
  m_timecodeScale = 1000000;
  m_duration = -1;
 
  while (pos < stop) {
    long long id, size;
 
    const long status = ParseElementHeader(pReader, pos, stop, id, size);

    if (status < 0)  // error
      return status;

    if (id == 0x0AD7B1) {  // Timecode Scale
      m_timecodeScale = UnserializeUInt(pReader, pos, size);

      if (m_timecodeScale <= 0)
        return E_FILE_FORMAT_INVALID;
    } else if (id == 0x0489) {  // Segment duration
      const long status = UnserializeFloat(pReader, pos, size, m_duration);

      if (status < 0)
        return status;

      if (m_duration < 0)
        return E_FILE_FORMAT_INVALID;
    } else if (id == 0x0D80) {  // MuxingApp
      const long status =
          UnserializeString(pReader, pos, size, m_pMuxingAppAsUTF8);

      if (status)
        return status;
    } else if (id == 0x1741) {  // WritingApp
      const long status =
          UnserializeString(pReader, pos, size, m_pWritingAppAsUTF8);

      if (status)
        return status;
    } else if (id == 0x3BA9) {  // Title
      const long status = UnserializeString(pReader, pos, size, m_pTitleAsUTF8);

      if (status)
        return status;
     }
 
    pos += size;
    assert(pos <= stop);
  }
 
  assert(pos == stop);

  return 0;
 }
