Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3905eac9 authored by Wei Jia's avatar Wei Jia Committed by android-build-merger
Browse files

Merge "m4v_h263: update width/height only when they are valid." into klp-dev...

Merge "m4v_h263: update width/height only when they are valid." into klp-dev am: 2da03f40 am: 5e9a9442 am: 36eb1039 am: 1173c884 am: 3e99d147 am: 0cb6c1f2
am: a0f88fe1

Change-Id: I08ea2f520efb37c10fb25a193175fb5f7c0263a3
parents 0c259278 a0f88fe1
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
 * and limitations under the License.
 * and limitations under the License.
 * -------------------------------------------------------------------
 * -------------------------------------------------------------------
 */
 */
#include "log/log.h"

#include "mp4dec_lib.h"
#include "mp4dec_lib.h"
#include "bitstream.h"
#include "bitstream.h"
#include "vlc_decode.h"
#include "vlc_decode.h"
@@ -1336,8 +1338,7 @@ PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop)
            }
            }
            tmpvar = BitstreamReadBits16(stream, 9);
            tmpvar = BitstreamReadBits16(stream, 9);


            video->displayWidth = (tmpvar + 1) << 2;
            int tmpDisplayWidth = (tmpvar + 1) << 2;
            video->width = (video->displayWidth + 15) & -16;
            /* marker bit */
            /* marker bit */
            if (!BitstreamRead1Bits(stream))
            if (!BitstreamRead1Bits(stream))
            {
            {
@@ -1350,14 +1351,21 @@ PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop)
                status = PV_FAIL;
                status = PV_FAIL;
                goto return_point;
                goto return_point;
            }
            }
            video->displayHeight = tmpvar << 2;
            int tmpDisplayHeight = tmpvar << 2;
            video->height = (video->displayHeight + 15) & -16;
            int tmpHeight = (tmpDisplayHeight + 15) & -16;
            int tmpWidth = (tmpDisplayWidth + 15) & -16;


            if (video->height * video->width > video->size)
            if (tmpHeight * tmpWidth > video->size)
            {
            {
                // This is just possibly "b/37079296".
                ALOGE("b/37079296");
                status = PV_FAIL;
                status = PV_FAIL;
                goto return_point;
                goto return_point;
            }
            }
            video->displayWidth = tmpDisplayWidth;
            video->width = tmpWidth;
            video->displayHeight = tmpDisplayHeight;
            video->height = tmpHeight;


            video->nTotalMB = video->width / MB_SIZE * video->height / MB_SIZE;
            video->nTotalMB = video->width / MB_SIZE * video->height / MB_SIZE;