shithub: openh264

Download patch

ref: 9e005f4ddf7da695ec148f5601aa10f98cabf23c
parent: 033c6a0448227d6290b402435c7faec9d3063dd0
author: xiaotiansf <xiaotianshimail@gmail.com>
date: Thu Nov 7 06:11:32 EST 2019

fix issue 3203 - oss-fuzz reported bug 18747 which was not fixed in by the commit for fixing the issue 3197.

--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -502,6 +502,8 @@
 
       iVal = * ((int*)pOption); // boolean value for whether enabled End Of Stream flag
 
+      if (pDecContext == NULL) return dsInitialOptExpected;
+
       pDecContext->bEndOfStreamFlag = iVal ? true : false;
 
       return cmResultSuccess;
@@ -509,6 +511,8 @@
       if (pOption == NULL)
         return cmInitParaError;
 
+      if (pDecContext == NULL) return dsInitialOptExpected;
+
       iVal = * ((int*)pOption); // int value for error concealment idc
       iVal = WELS_CLIP3 (iVal, (int32_t)ERROR_CON_DISABLE, (int32_t)ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE);
       if ((pDecContext->pParam->bParseOnly) && (iVal != (int32_t)ERROR_CON_DISABLE)) {
@@ -550,6 +554,7 @@
       return cmInitParaError;
     } else if (eOptID == DECODER_OPTION_STATISTICS_LOG_INTERVAL) {
       if (pOption) {
+        if (pDecContext == NULL) return dsInitialOptExpected;
         pDecContext->pDecoderStatistics->iStatisticsLogInterval = (* ((unsigned int*)pOption));
         return cmResultSuccess;
       }