Code: void Segment::AppendCluster(Cluster* pCluster) {
  assert(pCluster);
  assert(pCluster->m_index >= 0);
 
   const long count = m_clusterCount + m_clusterPreloadCount;
 
   long& size = m_clusterSize;
  assert(size >= count);
   const long idx = pCluster->m_index;
  assert(idx == m_clusterCount);
 
   if (count >= size) {
     const long n = (size <= 0) ? 2048 : 2 * size;
 
    Cluster** const qq = new Cluster* [n];
    Cluster** q = qq;
 
     Cluster** p = m_clusters;
     Cluster** const pp = p + count;
 
 while (p != pp)
 *q++ = *p++;

 delete[] m_clusters;

    m_clusters = qq;
    size = n;

   }
 
   if (m_clusterPreloadCount > 0) {
    assert(m_clusters);
     Cluster** const p = m_clusters + m_clusterCount;
    assert(*p);
    assert((*p)->m_index < 0);
 
     Cluster** q = p + m_clusterPreloadCount;
    assert(q < (m_clusters + size));
 
     for (;;) {
       Cluster** const qq = q - 1;
      assert((*qq)->m_index < 0);
 
       *q = *qq;
       q = qq;

 if (q == p)
 break;
 }
 }

 
   m_clusters[idx] = pCluster;
   ++m_clusterCount;
 }

Vulnerability Type: DoS Exec Code Mem. Corr. 
CWE ID: CWE-20
Summary: libvpx in libwebm in mediaserver in Android 4.x before 4.4.4, 5.0.x before 5.0.2, 5.1.x before 5.1.1, and 6.x before 2016-06-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted mkv file, aka internal bug 23167726.
Commit Message: external/libvpx/libwebm: Update snapshot

Update libwebm snapshot. This update contains security fixes from upstream.

Upstream git hash: 229f49347d19b0ca0941e072b199a242ef6c5f2b

BUG=23167726

Change-Id: Id3e140e7b31ae11294724b1ecfe2e9c83b4d4207
(cherry picked from commit d0281a15b3c6bd91756e453cc9398c5ef412d99a)
