[FFmpeg-devel] [FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type
James Almer
jamrial at gmail.com
Fri Nov 30 17:53:01 EET 2018
On 11/30/2018 12:42 PM, Carl Eugen Hoyos wrote:
> 2018-11-30 10:54 GMT+01:00, Linjie Fu <git at videolan.org>:
>> ffmpeg | branch: master | Linjie Fu <linjie.fu at intel.com> | Wed Nov 28
>> 10:41:55 2018 +0800| [67cdfcf694f840d215be940f82545c45c9be193a] | committer:
>> Zhong Li
>>
>> lavc/qsvenc: assert uninitialized pict_type
>>
>> Assert in function ff_qsv_encode to avoid using uninitialized value:
>>
>> FF_DISABLE_DEPRECATION_WARNINGS
>> avctx->coded_frame->pict_type = pict_type;
>> FF_ENABLE_DEPRECATION_WARNINGS
>>
>> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
>> Signed-off-by: Zhong Li <zhong.li at intel.com>
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cdfcf694f840d215be940f82545c45c9be193a
>> ---
>>
>> libavcodec/qsvenc.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
>> index 3946c1d837..7f4592f878 100644
>> --- a/libavcodec/qsvenc.c
>> +++ b/libavcodec/qsvenc.c
>> @@ -1337,6 +1337,8 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext
>> *q,
>> pict_type = AV_PICTURE_TYPE_P;
>> else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType &
>> MFX_FRAMETYPE_xB)
>> pict_type = AV_PICTURE_TYPE_B;
>> + else
>> + av_assert0(!"Uninitialized pict_type!");
>
> You generally cannot assert on a value coming from an external library.
And using string literals in an assert may generate warnings.
Just error out returning AVERROR_INVALIDDATA.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list