shithub: openh264

Download patch

ref: 1e0a897c5a06b4d534966a01027e637d99721dae
parent: 2c6445ea9c198f7a68c795cccb7d6f3348c7715f
author: xiaotiansf <[email protected]>
date: Sun Aug 19 18:48:55 EDT 2018

Fix Bugzilla Bug-1479831. Check cabac bytes left, if there is no bytes left, it must return error.

--- a/codec/decoder/core/src/cabac_decoder.cpp
+++ b/codec/decoder/core/src/cabac_decoder.cpp
@@ -145,6 +145,9 @@
   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);
     uiBinVal ^= 0x0001;