Code: int vp8_remove_decoder_instances(struct frame_buffers *fb)
{
 if(!fb->use_frame_threads)
 {
        VP8D_COMP *pbi = fb->pbi[0];


         if (!pbi)
             return VPX_CODEC_ERROR;
 #if CONFIG_MULTITHREAD
        if (pbi->b_multithreaded_rd)
            vp8mt_de_alloc_temp_buffers(pbi, pbi->common.mb_rows);
         vp8_decoder_remove_threads(pbi);
 #endif
 
 /* decoder instance for single thread mode */
        remove_decompressor(pbi);
 }
 else
 {
 /* TODO : remove frame threads and decoder instances for each
         * thread here */
 }

 return VPX_CODEC_OK;
}

Vulnerability Type: DoS 
CWE ID: 
Summary: A denial of service vulnerability in libvpx in Mediaserver could enable a remote attacker to use a specially crafted file to cause a device hang or reboot. This issue is rated as High due to the possibility of remote denial of service. Product: Android. Versions: 4.4.4, 5.0.2, 5.1.1, 6.0, 6.0.1, 7.0, 7.1. Android ID: A-30436808.
Commit Message: vp8:fix threading issues

1 - stops de allocating before threads are closed.
2 - limits threads to mb_rows when mb_rows < partitions

BUG=webm:851
Bug: 30436808

Change-Id: Ie017818ed28103ca9d26d57087f31361b642e09b
(cherry picked from commit 70cca742efa20617c70c3209aa614a70f282f90e)
