shithub: openh264

Download patch

ref: 19b711bda6ac5e452cd36392b659a842f8511e7e
parent: 1e0a897c5a06b4d534966a01027e637d99721dae
author: xiaotiansf <xiaotianshimail@gmail.com>
date: Sun Aug 19 20:19:30 EDT 2018

A better way of fixing Bug-1479831 without potential performance hit.

--- a/codec/decoder/core/src/cabac_decoder.cpp
+++ b/codec/decoder/core/src/cabac_decoder.cpp
@@ -145,11 +145,8 @@
   int32_t iRenorm = 1;
   uint32_t uiRangeLPS = g_kuiCabacRangeLps[uiState][ (uiRange >> 6) & 0x03];
   uiRange -= uiRangeLPS;
-  if (pDecEngine->iBitsLeft < 0) {
-    return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_CABAC_NO_BS_TO_READ);
-  }
-  if (uiOffset >= (uiRange << pDecEngine->iBitsLeft)) { //LPS
-    uiOffset -= (uiRange << pDecEngine->iBitsLeft);
+  if (uiOffset >= (uiRange << (uint32_t)pDecEngine->iBitsLeft)) { //LPS
+    uiOffset -= (uiRange << (uint32_t)pDecEngine->iBitsLeft);
     uiBinVal ^= 0x0001;
     if (!uiState)
       pBinCtx->uiMPS ^= 0x01;