[FFmpeg-devel] [PATCH] lavc/qsvenc: replace assert0 with an error return when pict_type is uninitialized

Linjie Fu linjie.fu at intel.com
Mon Dec 3 10:34:13 EET 2018


pict_type may be uninitialized, and assert on a value coming from an external
library is not proper.

Return invalid data error in function ff_qsv_encode to avoid using uninitialized
value.

Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 7f4592f878..891253be76 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1338,7 +1338,7 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
         else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB)
             pict_type = AV_PICTURE_TYPE_B;
         else
-            av_assert0(!"Uninitialized pict_type!");
+            return AVERROR_INVALIDDATA;
 
 #if FF_API_CODED_FRAME
 FF_DISABLE_DEPRECATION_WARNINGS
-- 
2.17.1



More information about the ffmpeg-devel mailing list